Print an object: NSLog (@ "%@", Stu); The name and memory address of the object that is printed by default, and the description method needs to be overridden
// Override Description Method -(NSString *) description{ return [nsstring stringWithFormat:@ " title:%@,icon:%@,answer:%@,options:%@", Self.title, Self.icon, Self.answer, Self.options];} // One of the last options is an array, others can print normally, only the array cannot be printed, you need to extend a class to Nsarray, rewrite: Descriptionwithlocale method
Overriding method in Nsarray's classification Nsarray + log: Descriptionwithlocale
-(NSString *) Descriptionwithlocale: (ID) locale{nsmutablestring*STRM = [nsmutablestringstring]; [StrM appendString:@"(\ n"]; for(IDObjinchSelf ) {[StrM AppendFormat:@"\t%@,\n", obj]; } [StrM appendString:@")"]; returnStrM;}
This can be printed in Chinese, usually read from the plist file some properties, one of the properties is an array, programming to see if the array is taken, you can pass the above printing method;