當我使用UIAlertView時,我發現消息的textAligment是Center。例如,當我寫這篇文章的代碼:如何在UIAlertView中更改消息的對齊方式?
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil
message:@"this is first line \nsecondLine should be center"
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil, nil];
[alertView show];
效果如下:
正如我們看到的,文本「這是第一行」是在中央,但我想將其更改爲left.I知道UILabel可以改變文本的對齊方式,但我不知道是否可以在UIAlertView中進行更改。
我嘗試使用此解決方案。但我發現subViewArray中沒有任何對象。 – huixing
@huixing是的,它只適用於iOS <= 7.我編輯了我的答案。 – anhtu