在iPad 應用中, 判斷用戶是否登錄 , 如果未登錄 , 彈出警示框 , 帶有登錄按鈕的, 在
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
這個方法中調用登錄方法 , 彈出的登錄窗口瞬時消失 。 這是什麼問題呢 ?
或許這個登錄的彈出界面,跟UIAlertView的動畫衝突了。
UIAlertView的代理方法查了一下
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;這個方法是當View的隱藏動畫結束的時候進行回調;於是用了這個,呵呵,居然能看到效果了,嗯,多想想,多聯想 還是有好處的!!!
還有幾個回調:
- (void)alertViewCancel:(UIAlertView *)alertView;
//當用戶按下HOME鍵的時候,回調此方法,用戶點擊Cancel按鈕的時候不會回調此方法
- (void)willPresentAlertView:(UIAlertView *)alertView//開始顯示View的動畫之前進行回調
- (void)didPresentAlertView:(UIAlertView *)alertView//顯示動畫完成之後進行回調
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex//將要開始View隱藏動畫的時候進行回調
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView;//編輯任何默認的字段添加的風格之後調用