我想将我的UITextField字体名称和UIButton(取消,确定)颜色更改为AlertView的黑色。 但它并没有改变我的预期。
- (IBAction)newGroup:(id)sender{
self.alertView = [[UIAlertView alloc] initWithTitle:@"" message:@"새 그룹의 이름을 입격" delegate:self cancelButtonTitle:@"취소" otherButtonTitles:@"확인", nil];
self.alertView.tag = new_group;
self.alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[self.alertView show];
}
//自定义字体名称,UIAlertView控件的颜色
- (void)willPresentAlertView:(UIAlertView)alertView{
if(alertView.tag == new_group){
for(UIView *subView in alertView){
if([subView isKindOfClass:[UIButton class]]){
UIButton *button = (UIButton *)subView;
button.titleLabel.textColor = [UIColor blackColor];
}else if([subView isKindOfClass:[UITextField class]]){
UITextField *textView = (UITextField *)subView;
textView.font = [UIFont fontWithName:@"Helvetica" size:30.0f];
}
}
}
}
UITextField字体名称和字体大小,UIButton(取消,确定)在默认情况下看起来仍然相同。