I am a newbie to iPhone app development. I want to make a simple app using view-based template which will have a main menu (home screen) linking to different modules of the app. Modules will themselves be made up of either UINavigationController or UITabController.
First I just wanted to create and bug a module, so I took a NavigationController in MainWndows.xib(appDelegate) and stacked(linked) many ViewControllers to it.
Now I need to have main menu at start of app, where I have placed NavigationController. I am now confused what to do? I have got solution in my mind that place this NavigationController in new xib file and a mainMenuViewController in MainWindow.xib file and access navigation module as a modal. So my Question is that if my approach is right? How will I access this modal controller to push viewcontrollers onto it? Or is there other alternate for what I want..?
I hope my Question is clear...
Any suggestion or link is appreciable.
I have got a better idea in my mind. I am going to stick with NavigationController in MainWindows.xib. I will push Main Menu as Root view Controller with both its navigation bar and toolbar hidden. Depending upon the button tapped, I will further push appropriate View Controllers on NavigationController.
Related
I am currently working on MGSplitViewController .So in this custom
split view controller the root view controller is already present in side a navigation controller (MainWindow.xib) but my main aim is to get the MGSplitViewController working with a NavigationController in the details side also?
How can i do it, can anybody able to achieve this ?
I do that in one project.
Put a UINavigationController into MainWindow.xib and have it contain your normal detail controller. (You can either configure the detail controller directly or tell it to reference another xib file.) Link the detailViewController outlet in MGSplitViewController to your detail navigation controller.
Let me know if some part of that is giving you trouble.
Try this APSplitViewController project from SlavaBushtruk's github.
This will anwser to your requirement.
Thanks
I have the following structure in my app, is this a correct/valid way of doing it?
UINavigationController attached to the window, the rootcontroller in this navigationcontroller is a UIViewController that presents a tableview. When a user taps one of the rows a UITabBarController is pushed on the stack.
This works, however I began to be unsure when I read this:
Because the UITabBarController class
inherits from the UIViewController
class, tab bar controllers have their
own view that is accessible through
the view property. When deploying a
tab bar interface, you must install
this view as the root of your window.
Unlike other view controllers, a tab
bar interface should never be
installed as a child of another view
controller.
This is not recommended, but it should be OK. The aweful Wordpress app also does this. This depends on the design of your app.
I'm not shure about Apple's approval.
The reason why this is not recommended (and thus might not get approved - now or at a later point!) is user confusion.
Users are used to regard the tab bar as top-level navigation. So if dig down using the table and navigation, and then getting a UITabBar, this is horrible for navigation as the user doesn't know what to expect.
The solution here, of course depending on the use case, is a "switch" in the navigation bar or a toolbar. UISegmentedControl would be a natural choice.
hi
i am currently working in iphone navigation based application. so my app have 30 screen,after navigating five screen i need a TabbbarController . I add tabbar Controller OverMy viewController ( [self.View addSubView:tab.View];) my application work fine and navigation work perfect but my problem is that after navigating from tabScreen to other myViewController which inside tabbbar controller are not relaods but navigated view controller work fine .
so above my code adding tabbar is wrong then plz help me ,thanks in advance.
I have to say, that I don't fully understand your question, I guess this is due to the language barrier, but maybe you can elaborate your explanation a little more. However, I think that I understood your problem. You want a UITabbarController (respectively it's view) to be a subview of a UINavigationController. Is that correct?
The answer to this question is simple, but, I'm afraid, unsatisfying your you: You can't do that and even if you could, you shouldn't. Please have a look at Apple's excellent ViewController guide. It says:
Thus, a navigation controller can incorporate custom view controllers, and a tab bar controller can incorporate both navigation controllers and custom view controllers. However, a navigation controller should not incorporate a tab bar controller as part of its navigation interface. The resulting interface would be confusing to users because the tab bar would not be consistently visible.
I have an app where the appDelegate has a UITabBarController. Each of the tabs has a navigation controller which I currently use to push a single detail view onto the stack in each tab. I am hoping to replace my navigation controller on each of the tabs with a splitViewController. I use the Interface builder to provide the UINavigationController for each tab. I am having trouble loading a nib for each tab that has a UISplitViewController in it. I am getting an instance of the UITableViewController class displaying on the screen, but I am not getting the UISplitviewController or the Popover or the detail view etc. These classes are all working in a standalone app, but I am not able to get them into each of the tabs in one app. Although I am currently using the Interface Builder I am open to doing this programmatically. If someone has suggestions, or an example small project of a Tab based app with individual split views in the tabs I would appreciate it very much. (As this is my first question I am not sure how much code or other pictures from IB would be helpful for me to post. If you need further detail please let me know and I would gladly amend this post.)
Apple documentation
"The split view controller’s view should always be installed as the root view of your application window. You should never present a split view inside of a navigation or tab bar interface."
Moving on...
Not only shouldn't you -- if you do so, an error is thrown when you run. It's impossible.
Newbie question: is there an easy way to convert a view-based app to a navigation-based app? I have an existing app sample that was created as a view-based app, and need to be able to create additional viewcontrollers that can be nested. The app is currently using presentModalViewController calls and nibs to display windows. Trying to change these to pushViewController calls results in the views not being displayed. So I'm assuming it's because the pushViewController needs to use a Navigation view. Thanks in advance!
Since you're admittedly a newbie, I would take the approach of creating a new navigation-based project and copying over your .xib and .m/.h files.
If you want to do it the hard way :), you'll add a NavigationController object to your MainWindow.xib. Then add a UINavigationController member and outlet and property to your app delegate, and connect it in interface builder to the navigation controller. At the end of your application:didFinishLaunching: method in your app delegate, set the window's view to navigationController.view. Back in MainWindow.xib, set the root navigation item to the view controller that used to be displayed at launch.
In you applicationDidFinishLaunching:, create a UINavigationController and add its view to the view hierarchy, then save it off to an ivar.
This is exactly what the navigation-based template is doing. There is nothing special about a "view-based" or "navigation-based" app,.