第一次写文章,先简单分享一点代码开始,不对之处,还望指正。。。
1.获取app版本号,常用来做版本更新。
NSString *version = [[[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"];
2.在应用内打开设置,获取各种权限。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=应用的bundle ID"]];
3.iOS8之后修改系统弹出提示窗的字体颜色
UIAlertAction *action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[action setValue:[UIColor redColor] forKey:@"_titleTextColor"];
4.获取相机,麦克风,推送通知的权限状态
//摄像头权限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
//麦克风权限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
//推送通知权限
UIUserNotificationType type = [[UIApplication sharedApplication] currentUserNotificationSettings].types
5.在视图上面添加渐变色
- (CAGradientLayer *)shadowAsInverseWithFrame:(CGRect) frame;
{
CAGradientLayer *newShadow = [[CAGradientLayer alloc] init];
CGRect newShadowFrame = CGRectMake(0, 0, frame.size.width, frame.size.height);
newShadow.frame = newShadowFrame;
//添加渐变的颜色组合
newShadow.colors = [NSArray arrayWithObjects:(id)[UIColor redColor].CGColor,(id)[UIColor blackColor].CGColor,nil];
return newShadow;
}
今天先写到这里,还有一些尚需整理,欢迎大家纠正!
网友评论