NSDictionary *textDic = [NSDictionary dictionaryWithObjectsAndKeys:
[[UIColor blackColor] colorWithAlphaComponent:0.6f],UITextAttributeTextColor,[UIColor blackColor],UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(1, 0)],UITextAttributeTextShadowOffset,
[UIFont systemFontOfSize:13],UITextAttributeFont,nil];
NSDictionary *highTextDic = [NSDictionary dictionaryWithObjectsAndKeys:
[[UIColor whiteColor] colorWithAlphaComponent:1.0f],UITextAttributeTextColor,
[UIColor whiteColor],UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(1, 0)],UITextAttributeTextShadowOffset,
[UIFont systemFontOfSize:13],UITextAttributeFont,nil];
[self.Navbtnitem_segment setTitleTextAttributes:textDic forState:UIControlStateNormal];
[self.Navbtnitem_segment setTitleTextAttributes:highTextDic forState:UIControlStateSelected];
self.navigationController.view.backgroundColor = [UIColor clearColor];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >=7.0) {
self.navigationController.navigationBar.translucent = YES; //禁止半透明毛玻璃效果
self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; //返回按钮颜色
self.navigationController.navigationBar.barTintColor = [UIColor clearColor]; //bar背景颜色
[self.navigationController.navigationBar setBackgroundColor:[UIColor clearColor]];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:18]}; //标题颜色
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
}else{
[self.navigationController.navigationBar setTintColor:[UIColor clearColor]]; //bar背景颜色
self.navigationController.navigationBar.translucent = NO;
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:18]};
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
}
给label添加分割线
NSUInteger length = [oldPrice length];
NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:oldPrice];
[attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, length)];
[attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, length)];
[labelAnswer setAttributedText:attri];