重写系统description

2017-08-28  本文已影响22人  搬码小能手
打印模型.png 打印模型林的字段.png 重写系统description.png
- (NSString*)description{

    return [NSString stringWithFormat:@"%@{%@}",[super description],self.name];

}

description到底是什么东西?


description.png

description不是关键字. description是NSObject提供的一个属性

declaration:
@property(readonly, copy) NSString *description;
Description 
Returns a string that describes the contents of the receiver.
This method is used to create a textual representation of an object, for example in a formatted string:
翻译:返回一个描述接收者内容的字符串。
该方法用于创建对象的文本表示,例如在格式化的字符串中:
上一篇 下一篇

猜你喜欢

热点阅读