-1

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

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

1 回答 1

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";

        }
}
于 2013-08-24T05:13:14.380 回答