NSMutableAttributedString *attTitle = [[NSMutableAttributedString alloc]initWithString:@"标题1" attributes:@{NSForegroundColorAttributeName:[UIColor blueColor],NSFontAttributeName:[UIFont systemFontOfSize:17]}];
NSMutableAttributedString *attMessage = [[NSMutableAttributedString alloc]initWithString:@"message" attributes:@{NSForegroundColorAttributeName:[UIColor purpleColor],NSFontAttributeName:[UIFont systemFontOfSize:14]}];
UIAlertController *action = [UIAlertController alertControllerWithTitle:@"标题1" message:@"message" preferredStyle:UIAlertControllerStyleActionSheet];
[action setValue:attTitle forKey:@"attributedTitle"];
[action setValue:attMessage forKey:@"attributedMessage"];
UIAlertAction *alert1 = [UIAlertAction actionWithTitle:@"拍摄" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self loadCameraMovie];
}];
[alert1 setValue:[UIColor greenColor] forKey:@"titleTextColor"];
[action addAction:alert1];
UIAlertAction *alert2 = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self loadCamera];
}];
[alert2 setValue:[UIColor cyanColor] forKey:@"titleTextColor"];
[action addAction:alert2];
UIAlertAction *alert3 = [UIAlertAction actionWithTitle:@"从相册选择视频" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self loadPhotoLibraryMovie];
}];
[alert3 setValue:[UIColor orangeColor] forKey:@"titleTextColor"];
[action addAction:alert3];
UIAlertAction *alert4 = [UIAlertAction actionWithTitle:@"从相册选择照片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self loadPhotoLibraryPhoto];
}];
[alert4 setValue:[UIColor brownColor] forKey:@"titleTextColor"];
[action addAction:alert4];
UIAlertAction *alert5 = [UIAlertAction actionWithTitle:@"从相册选择多张照片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self loadQBImagePickerController];
}];
[alert5 setValue:[UIColor blackColor] forKey:@"titleTextColor"];
[action addAction:alert5];
UIAlertAction *can = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}];
[can setValue:[UIColor redColor] forKey:@"titleTextColor"];
[action addAction:can];
[self presentViewController:action animated:YES completion:nil];
UIAlertController颜色字号更改,个性十足~
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 北京时间10月2日,据《圣何塞水星新闻》报道,昨天勇士与掘金的季前赛开始之前,4届最佳防守球员本-华莱士把上赛季的...
- 『导言』 亲们,可能在开发中遇到变态需求,在ARC或者MRC之间切换?那怎么宏代码判断当前环境是ARC还是MRC?...