在didFinishLaunchingWithOptions中创build的控制器中更改NSString的值并重新加载该控制器

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { CGSize result = [[UIScreen mainScreen] bounds].size; if(result.height == 480) { // iPhone Classic NSLog(@"iPhone 4"); } if(result.height == 568) { // iPhone 5 NSLog(@"iPhone 5"); } } self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; SideMenuViewController *leftMenuViewController = [[SideMenuViewController alloc] init]; ContainerOfSideMenuByVeerViewController *container = [ContainerOfSideMenuByVeerViewController containerWithCenterViewController:[self navigationController] leftMenuViewController:leftMenuViewController]; self.window.rootViewController = container; [self.window makeKeyAndVisible]; return YES; } 

我想改变leftMenuViewController中存在的NSString的值并重新加载它,这样我可以根据新的数据更改逻辑。

我想在每个控制器中更改NSString,但是我无法像leftMenuViewController在只加载一次的didFinishLauchingWithOption中启动。

我怎样才能做到这一点?

你可以在leftMenuViewController做一个refresh方法,或者让你的NSString property*leftMenuViewController in Appdelegate file and make it定义SideMenuViewController *leftMenuViewController in file and make it属性合成it. Now you are able to refresh your it. Now you are able to refresh your with your NSString“ it. Now you are able to refresh your leftMenuViewController with your

 AppDelegate *appDelegate = [UIApplication sharedApplication]; [appDelegate.leftMenuViewController refresh:yourStr];