//联系人:石虎QQ:1224614774昵称:嗡嘛呢叭咪哄
一、概念效果图:
图1:
二、小数点实现代码
- (void)viewDidLoad {
[superviewDidLoad];
NSString *text =@"12345.6789";
NSString *floStr;
NSString *intStr;
if([text containsString:@"."]) {
NSRange range = [text rangeOfString:@"."];
floStr = [text substringFromIndex:range.location];
intStr = [text substringToIndex:range.location];
}
UILabel *introLabel = [UILabel lableFrame:CGRectZero title:nilbackgroundColor:[UIColor clearColor] font:kGlobalFontSize_28 textColor:[UIColor purpleColor]];
NSMutableAttributedString *indroStr = [NSMutableAttributedString setupAttributeString:text rangeText:intStr textColor:OKColorRGB(236,198,128)];
introLabel.attributedText = indroStr;
introLabel.frame = CGRectMake(10,100,500,40);
[selfaddSubview:introLabel];
}
注意:封装方法--链接:http://blog.csdn.net/shihuboke/article/details/78390255,只是在基础上判断小数点的字体大小和颜色