How to edit UIAlertAction text font size and color

后端 未结 7 887
时光取名叫无心
时光取名叫无心 2020-12-06 01:33

How to edit UIAlertAction text size and color? I have taken a UIAlertController acoording to it how to edit the size. This i smy Code



        
7条回答
  •  攒了一身酷
    2020-12-06 01:42

    Try this:

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Do you wish to logout?" message:@"abcd" preferredStyle:UIAlertControllerStyleActionSheet];
    
    NSMutableAttributedString *xyz = [[NSMutableAttributedString alloc] initWithString:@"pqrs"];
    
    [xyz addAttribute:NSFontAttributeName
                  value:[UIFont systemFontOfSize:30.0]
                  range:NSMakeRange(20, 15)];
    [alert setValue:xyz forKey:@"attributedTitle"];
    
    
    
    UIAlertAction *logout = [UIAlertAction actionWithTitle:@"logout" 
                                            style:UIAlertActionStyleDefault
                                            handler:^(UIAlertAction *action){
                                                        //your code for handling this
    }];
    UIImage *Image = [UIImage imageNamed:@"yourImage"];
    [logout setValue:accessoryImage forKey:@"image"];
    

提交回复
热议问题