Swift 中重写父类description方法,输出模型中的内容
// 重写基类中description属性
override var description:String {
let keys = ["access_token","uid","remind_in","screen_name","avatar_large"]
return dictionaryWithValuesForKeys(keys).description
}
OC中 在自定义的类中,将其中的属性在description中赋值,并返回
- (NSString *)description {
return [NSString stringWithFormat:@"<%@: %p, name: %@, age: %@>", NSStringFromClass([self class]), self, self.name, self.session, self.age];
}