如何处理subView中的touches事件

时间:2011-04-29 02:11:54

标签: iphone subview touches

这是我的代码:

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];
}

但为什么我无法在touches事件中运行代码?

1 个答案:

答案 0 :(得分:1)

尝试为您的视图和子视图设置用户互动