. IBActions , onTouchDown onTouchUp. IBOutlet . Interface Builder IBOutlet "Touch Down" "onTouchDown" "Touch Up Inside" "Touch Up Outside" "onTouchUp".
onTouchDown - , . onTouchUp - reset .
:
@interface TestViewController : UIViewController {
UIButton *testButton;
}
@property (nonatomic, retain) IBOutlet UIButton *testButton;
- (IBAction)onTouchDown;
- (IBAction)onTouchUp;
, onTouchDown, :
1)
2)
3) ( )
4)
, :
- (IBAction)onTouchDown:(id)sender
{
CGRect oldBtnRect = testButton.frame;
testButton.titleLabel.font = [UIFont systemFontOfSize:36];
[testButton sizeToFit];
testButton.frame = CGRectMake(testButton.frame.origin.x - ((testButton.frame.size.width - oldBtnRect.size.width)/2), testButton.frame.origin.y - ((testButton.frame.size.height - oldBtnRect.size.height)/2), testButton.frame.size.width, testButton.frame.size.height);
}
: 36.
:
- (IBAction)onTouchUp:(id)sender
{
CGRect oldBtnRect = testButton.frame;
testButton.titleLabel.font = [UIFont systemFontOfSize:15];
[testButton sizeToFit];
testButton.frame = CGRectMake(testButton.frame.origin.x - ((testButton.frame.size.width - oldBtnRect.size.width)/2), testButton.frame.origin.y - ((testButton.frame.size.height - oldBtnRect.size.height)/2), testButton.frame.size.width, testButton.frame.size.height);
}
. 15.
, , .
. , . , , , . ;)