Bạn có thể gán AppDelegate làm biến mẫu trong UIViewController
không? Giống như @property (nonatomic, weak) AppDelegate *appDelegate;
iOS - AppDelegate làm biến mẫu?
Tại sao tôi hỏi là vì tôi cần phải truy cập vào nó khá thường xuyên nên thay vì thực hiện:
AppDelegate *appDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate doSomething];
tôi có thể làm:
[appDelegate doSomething]
Nếu bạn thường xuyên truy cập vào trang này, tại sao không di chuyển công việc đó sang nơi khác? – Osiris