不断补充
1. 无法修改Button的Title
[myButton setTitle: @"myTitle" forState: UIControlStateNormal];
[myButton setTitle: @"myTitle" forState: UIControlStateApplication];
[myButton setTitle: @"myTitle" forState: UIControlStateHighlighted];
[myButton setTitle: @"myTitle" forState: UIControlStateReserved];
[myButton setTitle: @"myTitle" forState: UIControlStateSelected];
[myButton setTitle: @"myTitle" forState: UIControlStateDisabled];
A:
是由于myButton没有关联IBOutlet (按住CTL键将Button和变量管理起来)
2. 无法移动Button的位置
CGRect rect = [[self btnPlus] frame];
rect.origin.x += arc4random() % 100;
rect.origin.y += arc4random() % 100;
[[self btnPlus] setFrame:rect];
A:在ViewController的File Inspector中关掉Use Auto-Layout
3. 设置Button的Border
A:
#import <QuartzCore/QuartzCore.h>
[self btnPlus].layer.borderWidth = 1.0f;
[self btnPlus].layer.borderColor = [[UIColor lightGrayColor] CGColor];