我有一个imageView
,在里面我放了一个按钮。我有两个问题:
- 如何在不丢失功能的情况下正确添加按钮?
- 我如何
imageView
在方法中引用我的动画来为视图设置动画?
编码:
- (void)viewDidLoad
{
[super viewDidLoad];
UIImageView *grayFrame = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"expSqrGray.png"]];
[self.view addSubview:grayFrame];
grayFrame.frame = CGRectOffset(grayFrame.frame, 0, 0);
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeCustom];
testButton.frame = CGRectMake(20, 20, 200, 44);
testButton.backgroundColor = [UIColor blackColor];
[testButton setTitle:@"Test" forState:UIControlStateNormal];
[testButton addTarget:self action:@selector(tapped:) forControlEvents:UIControlEventTouchUpInside];
[grayFrame addSubview:testButton];
//[self.view addSubview:testButton];
}