如何才能访问UIAlertView
按钮的titleLabel
属性?我尝试过以下代码:
for (UIView *view in action.subviews)
{
if([view isKindOfClass:[NSClassFromString(@"UIAlertButton") class]])
{
//Do something with title label font
}
}
答案 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";
}
}