2011-03-07 50 views
0

我的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]; 
} 
+0

請檢查功能mailIt被調用,並請張貼的函數的代碼mailIt – visakh7 2011-03-07 09:46:15

+0

請把一個NSLog的作爲mailIt的第一行:看看有沒有什麼方法實際上是在設備上調用的。 – occulus 2011-03-07 10:34:21

+0

你可以使用NSLog或者只是在第一行mailIt上放置一個簡單的斷點: – 2011-03-07 10:35:16

回答

0
picker.mailComposeDelegate = self; 

本來應該

picker.mailComposeDelegate = camera; 
1

是否設備能夠使用canSendMail方法顯示視圖。

要配置設備發送郵件,您需要啓動郵件應用程序並設置您的電子郵件。

相關問題