当我使用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