我是非常 Cocoa Touch和Objective-C的新手,但我已經獲得了相當大的一點,我正在嘗試使用UIKit。我有一個鏈接到一個按鈕,更改標籤,並觸發一個UILocalNotification,這是操作方法的動作:UILocalNotification沒有觸發
- (IBAction)changeLabel:(id)sender {
self.LabelOne.text = @"WHAT UPPP!";
self.NotifyOne.alertBody = @"Testtttttt";
self.NotifyOne.alertAction = @"Got It.";
self.NotifyOne.fireDate = nil;
}
有任何錯誤或警告,但它只是不點火。我的行動方法有什麼問題嗎?
UPDATE
這裏是應用程序初始化代表包含UILocalNotification
:
@interface LearnAppDelegate : NSObject <UIApplicationDelegate> {
UIButton *_ModifyLabelButton;
UILabel *_LabelOne;
UILocalNotification *_NotifyOne;
}
@property (nonatomic, retain) IBOutlet UILocalNotification *NotifyOne;
請發表你的代碼,你居然安排或頁頭的'UILocalNotification'的一部分。 – fscheidl
什麼是IBOulet?只有當你想將它與某些東西聯繫起來時纔是如此。同時使屬性和聲明具有相同的名稱(_NotifyOne或兩者均爲NotifyOne)。 –
查看我更新的答案。 –