第一次寫文章,先簡(jiǎn)單分享一點(diǎn)代碼開始故河,不對(duì)之處吱韭,還望指正。鱼的。理盆。
1.獲取app版本號(hào)瞻讽,常用來做版本更新。
NSString *version = [[[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"];
2.在應(yīng)用內(nèi)打開設(shè)置熏挎,獲取各種權(quán)限速勇。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=應(yīng)用的bundle ID"]];
3.iOS8之后修改系統(tǒng)彈出提示窗的字體顏色
UIAlertAction *action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[action setValue:[UIColor redColor] forKey:@"_titleTextColor"];
4.獲取相機(jī),麥克風(fēng)坎拐,推送通知的權(quán)限狀態(tài)
//攝像頭權(quán)限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
//麥克風(fēng)權(quán)限
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
//推送通知權(quán)限
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;
}
今天先寫到這里烦磁,還有一些尚需整理,歡迎大家糾正哼勇!