- (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中启动,只加载一次。
我该怎么做?
答案 0 :(得分:0)
您可以在refresh
中制作leftMenuViewController
方法,或在property
中制作NSString
。
定义SideMenuViewController *leftMenuViewController in
Appdelegate file and make it
属性,
使用以下方法合成it. Now you are able to refresh your
leftMenuViewController with your
NSString`:
AppDelegate *appDelegate = [UIApplication sharedApplication];
[appDelegate.leftMenuViewController refresh:yourStr];