2016-06-12 63 views
2

我使用此代碼顯示UIAlert這會問簡單的輸入ios9 UIAlertController的UITextField太小

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert" message:@"Message" preferredStyle:UIAlertControllerStyleAlert]; 
[alert addAction:[UIAlertAction actionWithTitle:@"Click" style:UIAlertActionStyleDefault handler:nil]]; 
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { 
    textField.placeholder = @"Enter text:"; 
}]; 
[self presentViewController:alert animated:YES completion:nil]; 

也試過的iOS 7的這個代碼

UIAlertView *alertViewCustomQuestion=[[UIAlertView alloc]initWithTitle:@"Custom Question" message:@"Please enter your custom question!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil]; 
alertViewCustomQuestion.alertViewStyle=UIAlertViewStylePlainTextInput; 
[alertViewCustomQuestion show]; 

兩個顯示同樣的結果。雖然我看到的任何示例都有很好的寬度。 enter image description here

回答

1

我正在修復別人的代碼的錯誤,最後發現有一些類別正在改變它的行爲。

0

只要將此作爲未來其他人的參考,誰可能會偶然發現類似的問題。

我在上面的問題中遇到了與OP相同的問題,在我的案例中,它原來是我正在使用的項目中使用的PixateFreestyle框架。

顯然框架沒有被積極開發了,但幸運的是有一種FIX for the issue.