在做項目的時候遇到了一個問題,有關新浪微博的,就是調用新浪微博的一段代碼 放在button點擊事件里是能看到效果的,但是放到UIAlertView的點擊事件里,通過斷點測試是能執行到的,但是沒有出現效果,用的是這個方法:- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
突然間感覺調用新浪微博的網頁登陸頁面有一個webView的彈出界面,可能跟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;//編輯任何默認的字段添加的風格之后調用