UIButton的工作在模拟器,但不是在设备
问题描述:
我的UIButton工作在模拟器完美无瑕,但不能在iPhone上的iOS4UIButton的工作在模拟器,但不是在设备
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];
上的按钮显示正确的iPhone,它看起来像它的压制,但动作ISN没有推出。
后来编辑: 这是mailIt代码:我想你应该检查,如果您的设备被配置为发送,因为你正在使用MFMailComposeViewController邮件,但你没有在你的代码检查
-(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];
}
答
picker.mailComposeDelegate = self;
本来应该
picker.mailComposeDelegate = camera;
答
是否设备能够使用canSendMail方法显示视图。
要配置设备发送邮件,您需要启动邮件应用程序并设置您的电子邮件。
请检查功能mailIt被调用,并请张贴的函数的代码mailIt – visakh7 2011-03-07 09:46:15
请把一个NSLog的作为mailIt的第一行:看看有没有什么方法实际上是在设备上调用的。 – occulus 2011-03-07 10:34:21
你可以使用NSLog或者只是在第一行mailIt上放置一个简单的断点: – 2011-03-07 10:35:16