Button press events not getting called

153 views Asked by At

I added a button on a subview of my main view, and when i am pressing that button... I can see it pressed but its selector is not getting called. And when i keep pressing the button for long then its selector method gets called. If i dont add that button on the subview of main view ,then everything works fine. Can anyone tell where and what i am missing?

UIButton *btn =[UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setFrame:CGRectMake(0, 0, 120, 30)];
[btn addTarget:self action:@selector(pickImage:) forControlEvents:UIControlEventTouchUpInside];
[btn setAutoresizingMask:  UIViewAutoresizingFlexibleRightMargin];    
[btnView addSubview:pickBtn];
[self.view addSubview:btnView];
0

There are 0 answers