I am confused about some items on the iOS developer site and require explanation. In the below cases A, B the property / variable is going to get updated, but it doesn't. The page where the below code resides.
These are the property/variable
self.badgeView.firstName
NSDate *originalDate
These are the 2 snippets of code:
NSMutableString *nameString = [NSMutableString stringWithString:@"John"];
self.badgeView.firstName = nameString;
[nameString appendString:@"ny"];
NSDate *originalDate = self.lastModificationDate;
self.lastModificationDate = [NSDate date];
NSLog(@"Last modification date changed from %@ to %@", originalDate, self.lastModificationDate);
Those NSString
properties, if implemented The Right Way , will copy the parameter you pass.
NSMutableString *nameString = [NSMutableString stringWithString:@"John"];
self.badgeView.firstName = nameString;
[nameString appendString:@"ny"];
// you'll have to update it again, if you want that view's string updated:
self.badgeView.firstName = nameString;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.