MC学习笔记

1、title的使用 ---> navigation的title 和 tabbarItem.title是一样的

Class class=NSClassFromString(controllerName);
UIViewController*vc=[[class alloc]init];
vc.title=title;
vc.tabBarItem.image=[[UIImage imageNamed:imageName]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
vc.tabBarItem.selectedImage=[[UIImage imageNamed:[NSString stringWithFormat:@"%@_sel",imageName] ]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    ;
MainNavigationController*NVC=[[MainNavigationController alloc]initWithRootViewController:vc];  
 [self.tabBarMutableArray addObject:NVC];

2、button上某些文字给特殊的颜色

self.protolBtn = [UIButton buttonWithFrame:TCGRectMake(54, 535, 200, 13) normalTitle:@"同意《XXX协议》" normalTitleColor:UIColorFromRGB(0x333333)  normalTiltleFont:13 cornerRadiu:0 backGroundColor:UIColorFromRGB(0xffffff)  target:nil selector:nil];
self.protolBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    
[self.protolBtn.titleLabel setFont:[UIFont systemFontOfSize:13*SCALE] WithtColor:kOrangeMainColor substring:@"《XXX协议》"];
- (void) setFont:(UIFont *)font WithtColor:(UIColor *)textColor  substring:(NSString*)substring
{
    NSRange range = [self.text rangeOfString:substring];
    if (range.location != NSNotFound)
    {
        [self setFont:font range:range];
        [self setTextColor:textColor range:range];
    }
}

你可能感兴趣的:(MC学习笔记)