现在的位置: 首页 > 综合 > 正文

自定义ios UIAlertView, 重排按钮位置

2013年01月28日 ⁄ 综合 ⁄ 共 505字 ⁄ 字号 评论关闭

参考:http://www.cnblogs.com/xiaodao/archive/2012/07/12/2588582.html

首选,实现UIAlertView的Delegate ,UIAlertViewDelegate。

实现:

- (void)willPresentAlertView:(UIAlertView *)alertView

在这个方法里修攺布局简洁,方便,需要在这个方法中找到需要修攺的视图的tag

通过viewWithTag,得到view,再重设其frame,即可重布局需要修攺的视图

查找需要修攺的view的tag:

for (UIView * temp
in
[alertView subviews]) {

        NSLog(@"The Alert Subview Object:%@", temp);

    }

注意:在打印出来的log,按钮是这样UIThreePartButton,通过一般的 [[temp class] isSubclassOfClass:[UIButton class]],无法得到button




Demo URL: http://download.csdn.net/detail/take8619702/4698646

抱歉!评论已关闭.