IPhone SDK: switch from one view to another with a click of a button

I want to make a really simple iphone application: one screen with one button ... when you click the button, a new screen appears. It. No animations, nothing

I tried endlessly to make an example NavBar project ... and it works, but only if I use the UINavigationController with a table that I can use, etc. I also tried all skeletal projects in Xcode.

I thought I finished when I did this:

[[self navigationController] presentModalViewController:myViewController animated:YES];

But I could not do this without the UINavigationController. I just want a simple example.

Many thanks!

+3
source share
3 answers

- UIView, , , UIVIew , , .

UIView, - .

LoginView *login = [[LoginView alloc] initWithFrame: rect];
[mainView addSubview: login];
+7
[self presentModalViewController:myViewController animated:NO];

, , . , myViewController:

[self dismissModalViewControllerAnimated:NO];

( NO YES.) , . , , UIView, .

+6

- UINavigationController. . viewDidLoad UIControlEventTouchUpInside . , , :

[self.navigationController pushViewController:[[[SecondViewControllerClass alloc] initWithNib:nibName bundle:nil] autorelease]];

What kdbdallas will offer, but you won’t get any nice sliding effects, and the navigation bar will not change automatically and will not provide users with a back button.

+1
source

Source: https://habr.com/ru/post/1698728/


All Articles