當用戶點擊iPhone應用程序頁面中的圖像時,我想首先顯示自定義彈出窗口(這是用戶消息說「正在處理您的請求」 ),「開始」圖像觸摸處理之前。但是,不知何故,處理開始(甚至沒有顯示彈出窗口,儘管我已經編寫了代碼來在處理代碼之前顯示彈出窗口),但幾乎只會結束&,只有彈出窗口才會顯示。你能幫忙嗎?CocoaTouch - iPhone應用程序 - 執行前繼續顯示對話框
這是代碼片段:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
int emotionChosen = -1;
[self showUserNote:msg];
...
...
// This then calls a method to process the touch event
...
...
}
-(void) showUserNote:(NSString *)note {
if ((self.viewCtrlrUserNote == nil) || (self.viewCtrlrUserNote == NULL)) {
self.viewCtrlrUserNote = (ViewController_NoteToUser *) [((com_AppDelegate *) [[UIApplication sharedApplication] delegate]).storyboard instantiateViewControllerWithIdentifier:kNameViewCtrlrUserNote];
}
[self.viewCtrlrUserNote.view setFrame:CGRectMake(70.0,150.0,170.0,170.0)];
[self.viewCtrlrUserNote initializeViewWithNote:note];
[self.view addSubview:self.viewCtrlrUserNote.view];
[self.view bringSubviewToFront:self.viewCtrlrUserNote.view];
}
雖然想提出調用showUserNote(其應顯示彈出/對話框)「第一」,「然後僅」正在呼叫,其處理方法觸摸。但處理觸摸的方法首先開始執行&對話框僅在處理方法結束時出現,因此它破壞了目的!
我的開發環境:4.3.3的XCode的iPad,iOS 5的
我如何「任務」認爲iOS的「第一」顯示「之前」開始處理觸摸事件的用戶對話框?
你能解釋爲什麼特定的順序很重要嗎?典型的設計啓動了後臺工作,並在運行循環的相同輪迴中呈現「處理它」UI狀態。這兩件事實際上都是在應用程序返回時開始發生的,並且大部分時間都是人們想要的。你的processTouch代碼中會發生什麼,以破壞用戶界面的變化? – danh
處理代碼需要很長時間纔會出現問題,並且您希望向用戶顯示一條警告以等待? –