一般类的初始化方法

 

- (instancetype) initWithDict:(NSDictionary *)dict

{

    if (self = [super init]) {

        

        self.answer = dict[@"answer"];

        self.title = dict[@"title"];

        self.icon = dict[@"icon"];

        self.questions = dict[@"questions"];

        

    }

    return self;

}

 

+ (instancetype) questionWithDict:(NSDictionary *)dict

{

    return [[self alloc] initWithDict:dict];

}

 

posted @ 2014-11-07 23:46  斐济的夜光  阅读(220)  评论(0编辑  收藏  举报