在我的應用程序中有兩個場景。在第一個視圖控制器中我使用了uialertview,它會在30秒後彈出。如果我在30秒之前移動到下一個場景,則意味着第一個場景的UiAlertview不應該彈出。取消alertview的功能
0
A
回答
3
使用定時器,當你在自敗認爲,取消計時器:
self.myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f
target:self
selector:@selector(showPopUp)
userInfo:nil
repeats:YES];
然後:
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.myTimer invalidate];
}
+1
tanQ for ur's quick reply @Antonio,它的工作! – Ramdhas
0
採取定時器變量作爲全球
NSTimer *Timer;
Timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(showAlert) userInfo:nil repeats:YES];
-(void)showAlert
{
//show your alert view;
}
使用viewWillDisappear
方法禁用您的計時器,以防止在下一視圖中顯示警報控制器
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[Timer invalidate];
}
相關問題
- 1. 取消功能
- 2. UIView的功能與Alertview相似
- 3. NSIndexPath不工作DidSelectedRow與AlertView功能
- 4. 點擊取消jquery功能
- 5. jQuery取消父功能
- 6. 鼠標取消功能?
- 7. PHP取消鏈接功能
- 8. AlertView應該自行消失
- 9. AlertView裏面的alertView
- 10. 如何取消一個功能的JavaScript
- 11. 取消某個頁面上的功能
- 12. C#BackgroundWorker的取消與助手功能
- 13. WinForms Grid中的組/ Excel取消功能
- 14. Javascript中的重定向取消功能
- 15. jQuery的:取消綁定加載功能
- 16. 反轉/取消以前的jQuery功能?
- 17. jQuery的功能,將取消對點擊
- 18. 爲什麼我的AlertView取消3次點擊取消按鈕關閉?
- 19. 如何調用按鈕上的貪睡功能點擊alertview
- 20. 是pthread_setcancelstate功能取消點使可取消時
- 21. javascript取消匿名點擊功能
- 22. 在Android畫布上取消功能
- 23. 取消功能,有$超時運行
- 24. 點擊()取消功能後彈出內
- 25. listgrid smartgwt select取消選擇功能
- 26. 在php中取消鏈接功能
- 27. 在rails 3中取消訂閱功能
- 28. 如何取消選擇功能
- 29. 使用點擊來取消功能?
- 30. 取消鏈接功能不起作用
你能分享任何代碼嗎?你的具體問題是什麼? – iCode
你並沒有要求編碼問題來解決。你需要一些代碼或者一些特定的編碼問題。 –
請在回覆到下一個場景之前儘快回覆 – Ramdhas