2012-04-15 22 views
0

你能幫我解決這個問題嗎? 我正在做一個應用程序,您可以添加UIlocalNotifications,並且這些通知將轉到一個tableView。帶有UILocalNotification和DetailViewController的TableView

但我不知道如何做下面的一個: 當我點擊某一行時,我希望類DetailViewController採取「notification.alertbody」.text,並把標籤放在DetailViewController。 有人可以幫助我在這個mettod?

這是行不通的!

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
UILocalNotification *notification = [self.notificationsArray objectAtIndex:indexPath.row]; 
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]]; 
[dvController.nomeMedicamento setText:[notification alertBody]]; 
[self.navigationController pushViewController:dvController animated:YES]; 
[dvController release]; 
} 

其中 'nomeMedicamento' 是@property(非原子,保留)IBOutlet中的UILabel * nomeMedicamento;從DetailViewController

我已經添加了通知類有這個方法:

- (void)addNotification { 

UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 

localNotification.fireDate = self.datePicker.date; 
localNotification.alertBody = self.messageField.text; 
. 
. 
. 
} 

我想這messageField.text!

謝謝,我很抱歉我的英語!

回答

0

你是什麼意思,當你寫「這不行!」?

你的方法沒有被調用?你的變量沒有通過?你的viewController沒有被推送?

您是否檢查了alertBody的內容?

[dvController.nomeMedicamento setText:[notification alertBody]]; 
NSLog(@"nomeMedicamento = %@", dvController.nomeMedicamento.text); 
相關問題