2011-07-15 9 views

答えて

2

あなたが表示することはできませんを表示する方法

- (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]; 

} 

アプリケーションがバックグラウンドのときにUIAlertViewを実行します。あなたはUIAlertView形式で提供されるUILocalNotificationを使うことができますが、各アプリの通知数には制限があります。 UILocalNotificationをスケジュールするには、tutorialに従ってください。

+0

Thnx助けてください) – Ruslan

+0

NSTimerとUILocalNotificationを追加する方法を教えてもらえますか?ファイルをappdelegateして30秒ごとに表示する方法はありますか? – Ruslan

+0

バックグラウンドタスクを開始しない限り、NSTimerはバックグラウンドにいるときには機能しません。 http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html –

関連する問題