2011-04-29 64 views
0

这里是我的代码:如何处理触摸事件子视图

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

但为什么我不能运行触摸事件中的代码?

+0

这是Java吗?目标C?什么语言? – 2011-04-29 02:15:27

+0

Xcode。 iPhone的东西。 – Mikecito 2011-04-29 02:36:52

+0

你在哪里使用initButtonBarComponentWithButtonArray方法中的数组? – 2011-04-29 02:40:53

回答

1

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

+0

自己解决了这个问题。一世 – FengChui 2011-04-30 03:22:56