Call storyboard scene programmatically (without needing segue)?

前端 未结 8 764
既然无缘
既然无缘 2020-12-04 10:10

I have a modal storyboard scene that I want to be accessible to all my other scenes. Creating a modal segue to it from every scene on my storyboard creates a big mess of str

8条回答
  •  自闭症患者
    2020-12-04 10:31

    Call to navigate to other class

    UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    
    UINavigationController *navController = (UINavigationController *)window.rootViewController;
    
    DumpFeed *dump = [storyboard instantiateViewControllerWithIdentifier:@"DumpFeed"];
    
    dump.isPushed=YES;
    
    dump.strUserId = appDelegate.strFriendid;
    
    
    [navController pushViewController:dump animated:YES];
    

提交回复
热议问题