一些我收集的代码
样式
#pragma mark - ============= 各初始化方法 ===============
#pragma mark - ============ 各界面触发方法 ==============
#pragma mark - ========== 各UI界面控件创建方法 ===========
#pragma mark - =========== 各点击事件的判断触发 ===========
#pragma mark - ============== 触发请求方法 ==============
#pragma mark - =========== 各协议事件的判断触发 ============
#pragma mark - UITableViewDelegate
#pragma mark - ============== (第三方功能区) =============
#pragma 支付宝、微信支付、分享等等
uibutton 的图片和文字的偏移
_attenBtn=[[UIButton alloc]init];
_attenBtn.frame=CGRectMake(245, 20, 60, 30);
_attenBtn.backgroundColor=[UIColor redColor];
[_attenBtn.imageView setContentMode:UIViewContentModeCenter];
[_attenBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -5.0, 0.0, 5)];
[_attenBtn setImage:[UIImage imageNamed:@"atten1"] forState:UIControlStateNormal];
[_attenBtn.titleLabel setContentMode:UIViewContentModeCenter];
[_attenBtn.titleLabel setFont:[UIFont systemFontOfSize:13]];
[_attenBtn setTitleEdgeInsets:UIEdgeInsetsMake(0.0, 5.0, 0.0, 5.0)];
// [_attenBtn.titleLabel setTextColor:[UIColor blackColor]];
[_attenBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_attenBtn setTitle:@"关注" forState:UIControlStateNormal];
前面的是上下移,后面的是左右移
.h 文件里面直接把小model加进去 @pro…(non,copy)UserModer *user;
因为model都是字典
.m文件里面就这样写
大模型里面取小模型
- (instancetype)init
{
self = [super init];
if (self) {
_user=[[XTBaskUserModel alloc]init];//初始化
}
return self;
}
-(void)setValue:(id)value forKey:(NSString *)key
{
if ([key isEqualToString:@"user"])
{
[_user setValuesForKeysWithDictionary:value];
}
else
{
[super setValue:value forKey:key];
}
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
// NSLog(@"=======%@",value);
}