0
林与计时器创建应用程序,并显示弹出窗口埃夫里30秒如何显示UIAlertvew然后applicacation在后台运行
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:viewController.view];
[window makeKeyAndVisible];
timer = [NSTimer scheduledTimerWithTimeInterval:(30)
target:self
selector:@selector(showpopup:)
userInfo:nil
repeats:YES];
}
-(void) showpopup:(NSTimer *)theTimer{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"YAHooo!" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
如何改变代码显示在后台模式弹出窗口
Thnx它可以帮助我) – Ruslan
你能帮我添加NSTimer和UILocalNotification来添加appdelegate文件来每隔30秒显示一次吗? – Ruslan
当您在后台时,NSTimer将无法工作,除非您开始后台任务。请参阅http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html –