我想在一个
如果我不使用
我想在这个按钮里添加动画效果,有什么建议吗?请参考以下内容:
UIButton
中添加一个UILabel
。
这是我的代码:- (void)viewDidLoad
{
[super viewDidLoad];
[[self addressSearch] setDelegate:self];
[[self worldMap] setDelegate:self];
self.boolPushButtonTapped = YES;
self.addressSearch.barStyle = 1;
//Create pushButton
self.pushButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.pushButton.frame = CGRectMake(106, 436, 110, 59);
[self.pushButton setBackgroundImage:[UIImage imageNamed:@"pushButton2.png"] forState:UIControlStateNormal];
[self.pushButton addTarget:self action:@selector(pushButtonTapped) forControlEvents:UIControlEventTouchUpInside];
//Label
self.distanceLabel = [[UILabel alloc] init];
self.distanceLabel.text = @"test";
[self.pushButton addSubview:self.distanceLabel];
[self.view addSubview:self.pushButton];
}
如果我不使用
alloc
init
,就会收到一个错误提示。而如果我使用它,那么标签中的文本就没有改变。
错误提示:*** Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation/Foundation-992/Layout.subproj/NSLayoutConstraint.m:560
2012-10-01 14:01:01.889 RemindMe[1116:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'
我想在这个按钮里添加动画效果,有什么建议吗?请参考以下内容:
我想为这个按钮添加动画效果,你有什么建议吗?