본문 바로가기

6. With IT/6.3 iOS

AppDelegate에서 ViewController의 Method사용하기

출처 : http://stackoverflow.com/questions/18950670/calling-uiviewcontroller-method-from-app-delegate/18950742#18950742?newreg=8dea532ee4b542efa43cf52ad12a3751


For example: In your ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    appDelegate.myViewController = self;
}

And in your AppDelegate:

@class MyViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (weak, nonatomic) MyViewController *myViewController;

@end

And in the AppDelegate's implementation:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self.myViewController goToBeginning];
}


'6. With IT > 6.3 iOS' 카테고리의 다른 글

extern C문제  (0) 2013.10.07
Xcode Debug option  (0) 2013.05.28
시너지프로그램 맥10.8 윈도우 7  (0) 2013.04.25
Xcode에서 SVN사용법  (0) 2013.04.25
setter getter??  (0) 2013.03.19