方法调用之间有什么区别:
如果有的话?
time.text = s;
[time setText:s];
https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/JumpRightIn/iPhone101/Articles/06_ImplementingController.html的教程同时使用了这两种方法:
什么时候使用什么?
如果这很重要,我对 Objective-C 来说是相对较新的。
- (IBAction)changeGreeting:(id)sender {
self.userName = self.textField.text;
NSString *nameString = self.userName;
if ([nameString length] == 0) {
nameString = @"World";
}
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!", nameString];
self.label.text = greeting;
}