UIAlertController 標題文字大小 顏色


 

NSString *title = [NSString stringWithFormat:@"\n恭喜您獲得%d個紅包\n", 10];
    NSString *msg = @"\n把紅包分享給微信好友,金額隨機,可用於購買雪票和雪卡";
    UIAlertController * alert = [UIAlertController alertControllerWithTitle:title
                                                                    message:msg
                                                             preferredStyle:UIAlertControllerStyleActionSheet];
// titile字號處理
    NSMutableAttributedString *hogan = [[NSMutableAttributedString alloc] initWithString:title];
    [hogan addAttribute:NSFontAttributeName
                  value:[UIFont systemFontOfSize:20.0]
                  range:NSMakeRange(0, title.length)];
    [alert setValue:hogan forKey:@"attributedTitle"];
//
    
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"給好友發紅包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self shareAction];
    }];
    [alert addAction:sureAction];
    

    alert.view.tintColor = APP_MAIN_COLOR;
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
                                                           style:UIAlertActionStyleCancel
                                                         handler:nil];
    [alert addAction:cancelAction];
    
    [self presentViewController:alert animated:YES completion:nil];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM