サブビューでタッチイベントを処理する方法
質問
これが私のコードです:
Mainview:
NSArray *btArray = [NSArray arrayWithObjects:@"1",@"1",@"1",@"1",@"1",nil];
ButtonBarComponent *bottomeButtonBar = [[ButtonBarComponent alloc] initButtonBarComponentWithButtonArray:btArray];
bottomeButtonBar.frame = CGRectMake(0, 340, 320, 200);
[self.view addSubview:bottomeButtonBar];
サブビュー:
-(id)initButtonBarComponentWithButtonArray:(NSArray *)btArray {
self = [[UIView alloc] initWithFrame:CGRectMake(0, 340, 320, 200)];
self.backgroundColor = [UIColor whiteColor];
}
しかし、なぜタッチイベントでコードを実行できないのですか?
解決
ビューとサブビューのためにユーザーインタラクションを有効に設定してみてください
所属していません StackOverflow