FengChui
FengChui

Reputation: 3

How to handle the touches event in subView

Here is my code:

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

subView:

-(id)initButtonBarComponentWithButtonArray:(NSArray *)btArray {
self = [[UIView alloc] initWithFrame:CGRectMake(0, 340, 320, 200)];
self.backgroundColor = [UIColor whiteColor];
}

but why I cant run the code in touches event?

Upvotes: 0

Views: 289

Answers (1)

Rahul Vyas
Rahul Vyas

Reputation: 28720

try setting user interaction enabled for your view and subview

Upvotes: 1

Related Questions