I hava a question about screen transition.
To transit a screen, I often use presentViewController method.
NextViewController *nextViewController = [[NextViewController alloc] init];
nextViewController.view.frame = CGRectMake(10, 10, 200, 400);
[self presentViewController:nextViewController animated:YES completion:nil];
However, the view.frame setting that I implemented is not applied.
Following code runs correctly.
NextViewController *nextViewController = [[NextViewController alloc] init];
[self presentViewController:nextViewController animated:YES completion:nil];
nextViewController.view.frame = CGRectMake(10, 10, 200, 400);
What’s the difference of these code?
Is view.frame redefined in presentViewController method?
Thanks.
The above code is not working because you are setting the view of nextViewController which not yet created.
so in your next code you load the view controller first and then change the frame of the loaded view.
=========================EDIT===========================
If you want to set the frame in the view controller directly then bind your view with a
IBOutletand then inHope it helps 🙂