项目代码片段

<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 allocinitWithData: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的高度
  1. CGAffineTransform transform = CGAffineTransformMakeScale(1.0f, 3.0f);  
  2. progressView.transform = transform;  





                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值