如何在UIAlertView中对齐消息? [英] How to align messages in UIAlertView?

查看:123
本文介绍了如何在UIAlertView中对齐消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何设置警报视图的委托消息的对齐方式。任何人都有解决方案,PLZ回复一些代码。

i want to know how to set the alignment of delegate message of alert view. anyone has solution, plz reply with some code.

推荐答案

您需要获取alertView的子视图。迭代子视图的数组,它将有一个UILable类型的项目。从子视图数组中获取UILabel,并为此设置textAlignment属性。

You need to get alertView's subViews. Iterate through the array of subview's, it will be having one item of type UILable. Get that UILabel from subview array and for that you can set textAlignment property.

NSArray *subViewArray = alertView.subviews;
 for(int x=0;x<[subViewArray count];x++){
 if([[[subViewArray objectAtIndex:x] class] isSubclassOfClass:[UILabel class]])
  {
      UILabel *label = [subViewArray objectAtIndex:x];
    label.textAlignment = UITextAlignmentCenter;
  }

}

这篇关于如何在UIAlertView中对齐消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆