* @return 用户对象
*/
-(KCUser *)initWithName:(NSString *)name screenName:(NSString *)screenName profileImageUrl:(NSString
*)profileImageUrl mbtype:(NSString *)mbtype city:(NSString *)city;
/**
* 使用字典初始化用户对象
*
* @param dic 用户数据
*
* @return 用户对象
*/
-(KCUser *)initWithDictionary:(NSDictionary *)dic;
#pragma mark - 静态方法
+(KCUser *)userWithName:(NSString *)name screenName:(NSString *)screenName profileImageUrl:(NSString
*)profileImageUrl mbtype:(NSString *)mbtype city:(NSString *)city;
@end
KCUser.m
//
// KCUser.m
// UrlConnection
//
// Created by Kenshin Cui on 14-3-22.
// Copyright (c) 2014年 Kenshin Cui. All rights reserved.
//
#import "KCUser.h"
@implementation KCUser
-(KCUser *)initWithName:(NSString *)name screenName:(NSString *)screenName profileImageUrl:(NSString
*)profileImageUrl mbtype:(NSString *)mbtype city:(NSString *)city{
if (self=[super init]) {
self.name=name;
self.screenName=screenName;
self.profileImageUrl=profileImageUrl;
self.mbtype=mbtype;
self.city=city;
}
return self;
}
-(KCUser *)initWithDictionary:(NSDictionary *)dic{
if (self=[super init]) {
[self setValuesForKeysWithDictionary:dic];
}
return self;
}
+(KCUser *)userWithName:(NSString *)name screenName:(NSString *)screenName profileImageUrl:(NSString
*)profileImageUrl mbtype:(NSString *)mbtype city:(NSString *)city{
KCUser *user=[[KCUser alloc]initWithName:name screenName:screenName profileImageUrl:profileImageUrl mbtype:mbtype
city:city];
return user;
}
@end
KCStatus.h
//
// KCStatus.h
// UITableView
//
// Created by Kenshin Cui on 14-3-1.
// Copyright (c) 2014年 Kenshin Cui. All rights reserved.
//
#import <Foundation/Foundation.h>