更改UIActionSheet的UIAlertButton字体

时间:2013-08-24 05:07:48

标签: iphone ios uialertview uiactionsheet

如何才能访问UIAlertView按钮的titleLabel属性?我尝试过以下代码:

for (UIView *view in  action.subviews)
    {
        if([view isKindOfClass:[NSClassFromString(@"UIAlertButton") class]])
        {
            //Do something with title label font
        }
    }

1 个答案:

答案 0 :(得分:4)

尝试这样,您可以根据您的要求更改view.tag

 - (void)willPresentAlertView:(UIAlertView *)alertView{
       for(UIView *view in alertView.subviews)
        if(([view isKindOfClass:[UIButton class]]) && (view.tag ==1)){
            UIButton *btn = (UIButton *)view;
            btn.titleLabel.text=@"your title";

        }
}