문제

i made a single view project with storyboard, added a couple of viewcontrollers. the initial viewcontroller has a simple button to display another viewcontroller

- (IBAction)doPhotoAlbumBtn:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main.storyboard" 
                                                         bundle:nil];
    VCDecorations *ieVC = 
     [storyboard instantiateViewControllerWithIdentifier:@"VCDecorations"];
    [self presentViewController:ieVC animated:NO completion:nil];
 }

I imported the class, connected the biecontroller in the ib to the right class, have on the viewcontroller the right identifier and checked the "use storyboard ID" checkbox and i feel like im missing smth very basic. help me guys. Thanks.

도움이 되었습니까?

해결책

If you only want to switch to a UIViewController inside the same storyboard as the current UIViewController is in you can do that with this:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ID"];
[self presentViewController:vc animated:NO completion:nil];

EDIT

To pass data you use a block in completion:block, add a property for the object you want to pass things to. The block executes when the animation is done.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top