I have a master detail application. I have several views and I push them into the detailNavigationController. But every time I want to show the views I need to push them again and there are a lot of viewControllers in the detailNavigation controller. Is there a way to navigate to a viewController that's already been pushed to the navigation controller?
I just use the popToViewController: method.
Related
Im trying to present a modal view controller from subclass of UITabBarController. I present it from viewDidLayoutSubviews method. Everything works fine on iOS 7 but in iOS 8 when app stars i still breafly see TabBarControllers first tab.
TabBarController is set as initial view controller in storyboard.
Is this even a good way to present it or there is something for iOS 8 that i dont know?
I don't have the rep to post a comment, so I'll seek clarification and provide guidance through this answer.
Is the intention that the modally presented view controller will be the first thing people see when they launch the app? And then I suppose it gets dismissed, and behind it will be the tabbar controller? How is your storyboard currently set up for the modal view controller if the tabbar is set to be the initial view controller?
One place to start could be to move to code to viewWillLoad or viewDidLoad rather than viewDidLayoutSubviews. I could also suggest to just make the modal VC the initial view controller
I have a storyboarded app with a chain of tableviews followed by a detail view. Kind of the classic iPhone app. There are 4 tabs and each one leads to a navigation controller.
The issue is I really want to avoid unnecessary glue code since the app is basically finished. If it was possible to connect the Search and Favorites (bottom two off the tab bar) controller as 'Root View Controllers' to the same UIViewController I would be done. However, this won't work since a view controller can only be the root view controller to one tab. So as you can see I've instituted two dummy UIViewControllers that forward you to the UIViewController in the middle. Now, unfortunately, I have to write code to make that central view controller a fake root view controller to disable the appearance of the back button, and prevent popping to the blank root when you double-tap the tab bar.
Has anyone got a more elegant solution?
This appears to be a flaw in Storyboards. One workaround would be to use simple view controllers for each navigation controller's rootViewController. Put a UIContainerView in each that points to the UIViewController you want to share.
For my new app I'm planning to use UINavigationController to push/pop other controllers.
Here is the scenario.
Application is running. Via navigation controller I push first controller on the stack. The user make some selections and touch a button. Then navigation controller push the second controller and so on while the user reach the last controller which is sixth. Controllers from first until fifth will never be used again in the app.
Is this the correct approach (using navigation controller) for such kind of app ?
I am not entirely sure what you mean, but I guess you need to walk the user through step 1 to 5, then when they done at 6, they cannot go back. Is that correct?
I did something similar. What I did was pop up view 1-6 modally(and navigate from 1 to 6) to interrupt from the current flow, and once the user's done, the value got passed back to the view where you populate the modal view from(delegation) and then you do whatever next.
Not sure if i answered your question. Hope it helps.
If once they reach the 6th viewController they will never go back to the other viewControllers you can always pop to the rootViewController and then push the 6th viewController on. That way those other viewControllers are not in the navigationController stack.
It sounds like you have a flow of 5 linked screens, and then the rest of your app.
If so, yes, UINavigationController would work fine here. You would push those 5 screens, and when its done you would destroy the navigation controller and replace it with some view for the rest of your app.
So the UINavigationController would control one part of your app, but not your entire app.
I am a beginner in objective-c. Can anyone please tell me how can I switch from one view to another in an iPhone application.
View Programming Guide for iOS
iPhone View Switching Tuturial
How To Switch Views using Multiple Viewcontrollers (Method 1)
Switching Views with Animation
How to animate View swap on simple View iPhone App?
switch between uiviews with buttons and not uinavigation controllers
Switch between UIViewControllers using UISegmentedControl
There are 3 main controllers that can switch views for you:
UINavigationController
Here you push and pop views in a chain.
There will be a navigation bar on top which lets you navigate back to where you came from.
UITabbarController
Here all the views will be represented by tabs at the bottom of the screen.
You can switch back and forward between them by clicking them in the tabbar.
UIViewController
There is a method in UIViewController wich lets you "present" other viewcontrollers. It's called presentModalViewController:animated:
You will have to do your own navigation back to the parent by using dismissViewControllerAnimated:
You can also do your own switching with variations of addSubView: or view.hidden or similar, but I would recommend those 3 to begin with.
I am trying to build an iPad app set-up as a split-view, but on the detail page being able to drill down like a navigation controller.
An example of this working is the setting app on the iPad where if you select the 'General' tab you can then drill down on the detail page from say general > network > VPN
Any help or tips on this would be great. I thought it might be two navigation controllers on the root nib, but couldn't get this working.
you mean like General -> About ->.. (in ipad simulator) right .
if all your detail view needs the TableView, then its better to make your detailviewcontroller as the subclass of UITableViewCOntroller.
OR If you need different views when click on the cells of rootcontroller(left pane)
Create a method in DetailViewController say setDetailView{}. And call this method when click on the cell of RootController
inside this method,
remove all subviews from detailview
create UITableView and set its delegates
on tableview didSelect method, we can push other UIViewController instance
[self.navigationController push...]
Hope it helps.