<pre name="code" class="objc"><span style="font-family: Arial, Helvetica, sans-serif;">1.一段话中有不同属性的文字</span>
UILabel *helpPet = [MyControl createLabelWithFrame:CGRectMake(70, 0, 200, 20) Font:12 Text:nil];
NSMutableAttributedString *petNameString = [[NSMutableAttributedString alloc] initWithString:@"猫君"];
[petNameString addAttribute:NSForegroundColorAttributeName value:LIGHTORANGECOLOR range:NSMakeRange(0, petNameString.length)];
NSMutableAttributedString *helpPetString = [[NSMutableAttributedString alloc] initWithString:@"帮摇一摇"];
[helpPetString addAttribute:NSForegroundColorAttributeName value:GRAYBLUECOLOR range:NSMakeRange(0, helpPetString.length)];
[helpPetString insertAttributedString:petNameString atIndex:1];
<pre> helpPet.attributedText = helpPetString;
2.导航标题栏,比如有最新和最热两个按钮,点击按钮加载不同的数据(一般都是以TableView或者CollectionView的格式呈现)
方法一:
建立一个ScrollView,调整contentSize的大小,当点击事件发生时,进行手动contentOffset
建立两个TableView,坐标不同
方法二:
建立一个TableView
建立一个TempDataArray用来存放临时数据
再分别为最新和最热分别建立一个数组用来存放数据
每次点击事件发生时,都清空临时数据,再检查存放最新和最热数组中有没有数据,并对临时数据进行添加
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingISO_2022_JP_2);
NSString *result = [[NSString alloc] initWithData:data encoding:enc];
3.
设置空间的边框颜色self.layer.borderWidth = 1.0f; self.layer.borderColor = [UIColor colorWithRed:192.0f / 255.0f green:126.0f / 255.0f blue:39.0f / 255.0f alpha:1.0f].CGColor;
4.16进制颜色的定义#define UIColorFromHex(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 green:((float)((hex & 0xFF00) >> 8))/255.0 blue:((float)(hex & 0xFF))/255.0 alpha:1.0] #define kJBColorLineChartControllerBackground UIColorFromHex(0xb7e3e4)
-(void)(UIColor *) randomColor { CGFloat hue = ( arc4random() % 256 / 256.0 ); //0.0 to 1.0 CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0,away from white CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; //0.5 to 1.0,away from black return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; }
5.修改UIProgressView的高度
- CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);
- progressView.transform = transform;