ios alertView添加輸入框

 

初始化UIAlertView後

 設置 alertView 的alertViewStyle

UIAlertViewStylePlainTextInput 添加一個普通輸入框

UIAlertViewStyleSecureTextInput 密碼輸入框

UIAlertViewStyleLoginAndPasswordInput 普通輸入框加密碼輸入框

加一句

[alert addTextFieldWithValue:@"" label:@""]; 注:這個方法已經被列爲私有API,不可用了

[alert show];

 

 

然後在

-(void)alertView : (UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

       //得到輸入框

           UITextField *tf=[alertView textFieldAtIndex:0];

         

         [alertView release];

}

 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章