1
我是iOS 5的新手。從Apple的文檔中,我知道ARC是什麼,「對象的所有者應該使用strong
表示法」。讀的 「Hello World」 後,我發現一個奇怪的東西(我的意思是混淆了我)視圖控制器的UI元素的所有者是什麼? iOS5與ARC
HelloWorldAppDelegate:
@interface HelloWorldAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
HelloWorldViewController:
#import <UIKit/UIKit.h>
@interface HelloWorldViewController : UIViewController <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UILabel *label;
- (IBAction)changeGreeting:(id)sender;
@property (copy, nonatomic) NSString *userName;
@end
這裏:
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UILabel *label;
UI元素具有weak
表示法並且沒有任何文件具有strong
引用他們。所以我很困惑what/who hold them?
因此,UI框架創建並保存它們。 – Pikaurd