hi
i have a UIButton made programmatically and i want to add the target and the action for that button. i have use method addTarget: action: forControlEvents:
in IOS 4.1 this method is detected, but in 4.2 it didn't, here is my code
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if(version <= 4.1){
moreButton = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(6.3+5*widthSegment, 0.0, widthSegment, heightSegment)];
[moreButton addTarget:self action:@selector(getPopOverMore:) forControlEvents:UIControlEventTouchUpInside];
}
else{
//version 4.2
NSLog(@"versi 4.2");
moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
moreButton.frame = CGRectMake(6.3+7*widthSegment, 0.0, widthSegment, heightSegment);
[moreButton addTarget:self action:@selector(getPopOverMore:) forControlEvents:UIControlEventTouchUpInside];
}
and this is the action method :
- (IBAction)getPopOverMore:(id)sender{
if(moreFileController == nil) {
moreFileController = [[MoreFilePopController alloc]
initWithStyle:UITableViewStylePlain];
moreFileController.delegate = self;
moreFilePopOverController = [[UIPopoverController alloc]
initWithContentViewController:moreFileController];
}
CGRect frameMore = CGRectMake(6.3+5*widthSegment, 0.0, widthSegment, heightSegment);
[moreFilePopOverController presentPopoverFromRect:frameMore inView:navBar
permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
any body know, what's wrong here??