私は持っていて、imageView
その中にボタンを置きます。2つの質問があります:
- 機能を失うことなくボタンを適切に追加するにはどうすればよいですか?
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];
}