나는 iOS를 처음 접했고, 튜토리얼이나 교수로부터 배웠다. .h
파일에서
우리는이 :@ 합성하고 자기 자신을 사용하는 것
.m
파일에서
@interface ViewController : UIViewController <UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UILabel *myResponse;
@property (strong, nonatomic) IBOutlet UITextField *myInput;
@end
우리가 가진 :
@sysnthesize myResponse
@synthesize myInput
내 질문은 이것이다 : 추가 사이의 차이는 .m
파일에서, 무엇 @synthesize
및 그런 다음 [myInput <do something here>]
과 같은 속성을 사용하고 @synthesize
을 제거하고 [self.myInput <do something here>]
을 사용합니다. Xcode 5에서 실행 중이므로 자동 합성 기능을 사용할 수 있음을 이해하고 있지만 두 가지 기능 간에는 더 미묘한 차이점이 있습니까?
교수님이 @synthesize
을 사용했으며 다음 튜토리얼은 self.propertyName
을 사용하고 있었기 때문에 궁금합니다.
감사합니다.
방금 배우기 시작하면 가장 기본적인 질문은 Apple 설명서를 참조하십시오. https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html –
및 더 이상 @ 합성을 사용하지 마라. –