I am new in iOS programming.
What I am trying to do is:
I have some views in a storyboard and I’d like to switch between the views programatically. For example, when a button is clicked, I call a method and I want to change views here (I can call the method successfully). The buttons are also created programatically in different positions.
I have searched and I think it happens with NavigationController. I have a navigation controller which I created like so: menu Editor -> Embed In -> NavigationController. How could I do this using this NavigationController?
@Madhu and @Dilip ,I found a solution with xib filed class
icerik *secondViewController = [[icerik alloc] initWithNibName:@"icerik" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController];
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
navigationController.topViewController.title = @"SecondViewController";
//[self presentModalViewController:navigationController animated:YES];
if([self respondsToSelector:@selector(presentViewController:animated:completion:)])
[self presentViewController:navigationController animated:YES completion:^{/* done */}];
else if([self respondsToSelector:@selector(presentViewController:animated:)])
[self presentModalViewController:navigationController animated:YES];
I have a class with xib file named icerik, I solved it like this. It is opening but when I want to turn back, What can I do it ?
You can create btn using this code:
and for going to another vc use this code,if you want navigation bar:
Else use this code:
And for come back to frist vc fromm second vc add this code in second vc.