I just downloaded the apple same code Multiple Detail Views.
http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html
I was playing around with it to try and figure out how it works, and so far I have only had one problem: when I create my own files/view, there Menu button is not present.
Default first view controller with Menu button
The drop down menu with the third view that I created
The third view that I created, that has no menu button
I poked around the interface builder and there are no buttons there for the default views. Then I found a method in the RootViewController that displays the button.
My problem is that I can't find where the first 2 views call that method to display that button.
Answering my own question here:
In the end, all you have to do is link the view, and the toolbar to the file's owner. You can view a tutorial on how to do that here (in part 3c)
Related
So here is my situation, I have a few UIViewController's, they are:
View Controller
First Sector
Second Sector
The View Controller (1) has buttons on the left (within a UIView) and it has a UIContainerView which slides to the right (to reveal said buttons) with a gesture - this is hopefully going to be my menu (see screenshot).
The First Sector (2) I have managed to load as the default view of the ContainerView mentioned above.
I want to load the Second Sector (3) into the ContainerView when the button is clicked.
Screenshot so far:
How is it I am going to get this to load into the container?
I have tried to drag the "embed" from Presenting Segues across to the Container, however that just gives the option of viewDidLoad which obviously sets it as default.
There is a library that already implemented all work for you. It's called SWRevealViewController. It's a really powerful library to present menu on the left like you want to.
It seems like this should be easy to figure out, but I haven't had any luck this afternoon. I threw together this quick, simplified storyboard mockup of my problem.
Basically, I would like the table view controllers below to also be in a tab bar controller (in addition to the already present navigation controller). The tabs would switch between the two table view controllers.
Right now, the view controller with the buttons acts as a sort of menu. Each button leads to one of the table view controllers. Ideally this view controller would not have the tab bar visible, and would only be reachable from back buttons on the nav bars of the table view controllers.
I've tried a few different ways of embedding into a tabbarcontrollers but none of them produce the desired result:
-I've tried selecting both table view controllers and embedding those in a tab view controller. The tabbar doesnt show up in simulator, and the 'unreachable scene' warning appears.
-I've tried embedding the initial nav controller into a tabbarcontroller. This creates a tab entry for the first 'menu' page. It also causes issues with push segues once I connect the tableviews to the tabview.
I would be fine implementing some programmatic options on top of the storyboard, I just chose storyboarding for this project since it's a relatively simple presentation of data.
What is the proper way of going about this? Thanks!
A tab bar controller needs to be the root view controller of your view hierarchy. It goes against the HIG and Apple's standards to put a tab bar controller inside of any other type of container controller.
From the Apple docs:
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.
So, the bottom line here is you need to rethink your design. One option would be to set the UITabBarController as the root view of your window, and then have each of your UITableViewControllers inside of a UINavigationController, which is placed inside of the UITabBarController. In this way, you still get the navigation bar, and stay within Apple's design guidelines (you also won't get those pesky warnings, and Apple may even be throwing an exception nowadays if you try to install a UITabBarController as anything other than the root view of the window).
I accept JMStone answer but we might get into situation where we need to put tab bar controller inside other controller especially table view controller.
Please refer Storyboard navigation controller and tab bar controller
and also the good example by Matthjin: http://cl.ly/VQLa
Hopes it help some one who want to put tab bar controller inside table view controller and wants proper navigation.
I have a MAster/Detail Application and everything is fine. Now when loaded, we have the Button Named "Master" That will slide over the original Master View Controller. I want to change it's behavior ,so instead of popping over the original MasterViewController..i need it to popOver another SplitViewController with the option of going back to the original one. Any ideas how to create this? I dunno where to start. Any ideas will be highly appreciated
Please Check This Edit
Edit 1 :
To be more precise...i have a dictionary application that first loads all the elements in the master view controller on the left...once i click on any element, it will open up in details view controller as it should.
Once in the Details view controller..if i click on Add to Favorites button...and click on the button Show Favorites...i need it to show me in the MasterViewControlle all the selected favorites instead of all the dictionary elements...how can i do it?
Seeing your question i feel you want to have UISplitViewController like below.
I never worked on it but try out this tutorial and try to integrate this feature in your project.
Raywenderlich tutorial link Click here
UISplitViewController class reference Click here
check this Question already asked in stackoverflow if you want to use protocol objectiveC protocol issue Detail -> Master communication.
You can use KVO as well.Check this Link : http://2pi.dk/tech/cocoa/kvo_dispatch.html
I have a button in an app labelled "How to search", the referencing outlet is "btnHelpShow" and it has the method "handleHelpShowButton" attached to the "Touch up inside" event.
The app is a simple search engine to find prices for number plates:
This is the SearchView.xib file's hierarchy in Interface Builder
The view be in 4 states:
1) Waiting to search (pictured)
2) Showing help screen
3) Results found
4) No results found
State 2 and 4 create a view with a seperate .xib file and insert it onto the view stack, they then both have a button that hides the view and shows the search screen again.
State 3 is a sub-view inside SearchView.xib (pictured), as in I've just used interface builder to drag that view into the .xib. So it just gets it's hidden property set to YES/NO
After State 3 occurs, the "How to search" button stops working, and will only work again if you select the input field and type in another number plate.
I've used NSLog(#"pressed") as the first line of the handleHelpShowButton, and that doesn't get logged after State3, it's like the button's been disabled or there is an invisible view sitting over it stopping me from pressing it.
I'm not sure where to look from here? There's a lot of code so I don't want to post it all in one go.
Perhaps the subview that is created for state three overlaps the 'How To Search' button? Check the frame for that subview in an NSLog.
If this is indeed the reason, you could try:
[self.view bringSubviewToFront:howToSearchButton];
You can learn more reading the UIView documentation.
I have a fairly hefty project, where I am loading a few view controllers, one after the other. First, a splash screen, followed by a menu system, and when the user clicks on the menu it goes through to an article view controller.
Putting all these in with shouldAutorotate... set to YES for all rotations, this works fine. However, I have a menu bar I need to slide down over the top when a tap gesture has been recognised. I have one for the main menu, and one for the article view.
If I put one of these in, it still auto-rotates fine. However, as soon as I put the next one in, the auto-rotate stops working. I've tried putting the menu bars in the app delegate, as well as nesting them inside the menu/article view controllers. The Menu Bar view controller also has shouldAutorotate... set to YES. In fact, every single view controller in the project (all 7 of them) have it set to YES. And yet, when I add my second Menu bar controller, it stops auto-rotating. It doesn't even trigger the "shouldAutorotate" method to ask it.
The code is way too large to post here, but if you'd like to see anything in particular then just ask. I'm totally stumped! I'm about to pull the menu bars out of their view controller and code them up in each of the view controllers individually. This will be a hideous amount of code duplication, but I can't think of any other way round it!
Any ideas? Thanks!
The answer appears to be... Don't put view controllers within other view controllers! One view controller = one screen, seems to be the rule. I have a lot to learn!