【发布时间】:2011-08-08 21:42:15
【问题描述】:
我是 Cocoa Touch 和 Objective-C 的非常新手,但我已经掌握了很多要点,我正在尝试使用 UIKit。我有一个链接到更改标签并触发 UILocalNotification 的按钮的操作,这是操作方法:
- (IBAction)changeLabel:(id)sender {
self.LabelOne.text = @"WHAT UPPP!";
self.NotifyOne.alertBody = @"Testtttttt";
self.NotifyOne.alertAction = @"Got It.";
self.NotifyOne.fireDate = nil;
}
没有错误或警告,但它只是没有触发。我的操作方法有什么问题吗?
更新
这是包含 UILocalNotification 的 App Delegate 初始化:
@interface LearnAppDelegate : NSObject <UIApplicationDelegate> {
UIButton *_ModifyLabelButton;
UILabel *_LabelOne;
UILocalNotification *_NotifyOne;
}
@property (nonatomic, retain) IBOutlet UILocalNotification *NotifyOne;
【问题讨论】:
-
请将您的代码部分发布到您实际安排或分配
UILocalNotification的位置。 -
IBoulet 有什么用?仅当您想将其与某些东西联系起来时。同时使属性和声明同名(_NotifyOne 或 NotifyOne)。
-
无论如何,这一切似乎都被 iOS 5.0 打破了。或多或少...
标签: iphone cocoa-touch ios4 uilocalnotification