My UIButton works flawless in simulator but not on the iPhone with iOS4
picButton = [[UIButton alloc] initWithFrame:CGRectMake(165, 80, 90, 150)];
[picButton addTarget:self action:@selector(mailIt:) forControlEvents:UIControlEventTouchUpInside];
[picButton setBackgroundImage:[UIImage imageNamed:@"save_2.png"] forState:UIControlStateNormal];
[picButton setBackgroundImage:[UIImage imageNamed:@"save_2.png"] forState:UIControlStateSelected];
On the iPhone the button is displayed correctly, and it looks like it’s pressed but the action isn’t launched.
Later edit:
This is the code for mailIt:
-(IBAction) mailIt : (id)delegate{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"title!"];
NSString *emailBody = [NSString stringWithFormat:@"messagestring", imagename];
[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
}
Should have been