I have the following in my storyboard and would like to add a button at the top of the TableView that allows me to add Members.
The scenario, a user is presented with the first screen which displays 'User Profile' and 'Members'. When 'Members' is touched the next screen is displayed that shows a list of Members and at the top is a button that says '< Settings' whcih allows the user to go back one screen.
I am trying to display a 'Add' button at the top when the list of Members is displayed.
Hope that makes sense!! I was hoping to not have to Embed the TableView in another Nav Controller.
Thanks for any help!!!!
You can add a button into the navigation bar, but first, you need to have a navigation bar.
To do this, you need to select your scene in the Storyboard and then go to the the Editor menu and select Embed In:Navigation Controller.
Once this is done, you can drag in a Navigation Item from the panel on the right.
Then you can add that to your class as an IBOutlet and declare an IBAction for it.
Cool?
Also, I think that your storyboard file might not be set up right.
Check out Apple's Simple Drill Down sample file available here:
http://developer.apple.com/library/ios/samplecode/SimpleDrillDown/Introduction/Intro.html
Cheers.
Related
I have a 'main menu' view controller with links to different types of calculators. When I click on the link to a new calculator, the "main menu" can still be seen behind the new page. I would like to have the calculator completely replace the main menu when I click the link. I've tried modifying the segue on the storyboard, but cannot figure out how to fix this.
Storyboard settings
Purple outlines the main menu hiding behind the new view controller. I want this to go away.
You will need to embed the "Main Menu" into a Navigation Controller. If you don't do this, no matter what type of segue (which you refer to as a "link") you use, that outline will always be visible. To do this, select the Main Menu View controller from the storyboard, and click a little button on the bottom right of the screen looking like this:
and select "Navigation Controller".
Next, you can do one of the following:
Click on each segue from the main menu to each type of calculator, and in the attributes inspector, change the "Kind" (Which you currently have as "Present as Popover" to "Show".
Alternatively, if you like the way the segue slides up, and would just like it to be full screen,change the "Kind" setting to "Present Modally", and change the "Presentation" setting (under "Kind") to "Full Screen", for as many of the segues as you'd like.
I have a ViewController1 and ViewController2. ViewController1 has a NavigationController set to it. I have a button (Custom Search Icon) on the NavigationBar. Now I press control+click and drag to ViewController2 and set it to Show. When I press it, it doesn't work. I also tried to drag the button to ViewController1 and set it as an IBAction but that doesn't work either.
What I want accomplished:
I want to create a button on the left side of the NavBar. When clicking it, I want to be add the searchbar and allow the user to search from an array. What is the best way about doing this? The search bar also has the cancel button, and if pressed the user should return back to his previous ViewController. I don't want anyone to the work for me but if you could point me to the right direction, it would be awesome.
I'm assuming by "Custom Search Icon", you mean a UIBarButtonItem in the navigation bar. If that's the case you should be able to segue to a controller using the technique you described, so you could try putting in a new UIBarButtonItem and try again.
But for the problem you're describing I might recommend a slightly different approach using UISearchController. Since it sounds like you're using storyboards, drag in the Search Bar and Search Display Controller from the object library to your controller, just below the navigation bar.
Check out UISearchController documentation:
[https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UISearchController/ ]
And here's a sample project from Apple:
[https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html ]
Good luck!
Delete all the connections from the interface builder first. Clear the codes associated to the button.
Create an IBAction and put a break point to see if its called when u click the button.
If it does get called then push a new ViewController onto it,(ViewController2).
Add your search bar here on the ViewController 2.
I am working on Xcode5/iOS7. I have taken Tab-Bar based application with navigation controller on first tab. On first tab and first view, i am displaying search result in UITableView on search button click and then navigate from it to the next view. But when i come back its displaying me the search screen rather then showing me the search result.Anybody has any idea why its not restoring the position of subviews and making the whole screen looks like as it was at the time of loading for the first time.
regards,
V#run
I found out the solution for my problem. We need to turn-Off Autolayout option under file inspector of view. You can do it by
View > Utilities > Show File Inspector, and un-select the “Use Autolayout” option
Try this if you are using AutoLayout:
In the .xib file, select the VIEW and on the bottom-right menu, using AutoLayout, click in |-o-| symbol and select "Add Missing Constraints In View"
I'm trying to create a back button on my navigation bar in x code. However when I drag it across from the objects library to the navigation bar in the storyboard it doesn't come up.
OK So this is crazy but...
Click on the navigation bar and in the attributes inspector, Just Type something in the field marked Back Button. Then in the scene hierarchy you'll see the button, though it won't yet appear on your navbar. In the hierarchy, drag the button onto the Navigation Item and viola it appears. Now to make second one, hold option and copy the first one. If you try to add one from the object browser, you'll lose the first one.
If done properly, the first will show up on the right and the second on the left.
Good luck.
This happens when the navigation is not set up correctly, as dbajkovic mentioned, if you do not have a navigationcontroller, it will not work. Your scoreboard should look like this:
You can not add the button to the left, only to the right.
#Jonathan Thompson: I came across your post and since I just learnt something new, I am going to add it as a response to your question.
There are two separate buttons - Back button and Bar Button. Back button has a reverse (right to left) pointing arrow and a Bar button is a regular rectangular button. The following describes how your could implement them in your program:
Back button:
On the root view controller, ctrl + click on button and drag it to the view controller you are trying to connect it to. When you are given an option to select from, choose Push, not modal. This will automatically add a back button on the next view controller. (Run the program to confirm it.)
Bar Button: (Credit: dbrajkovic)
For adding the bar button, click on navigation bar of the navigationViewController you are interested in. Under Attributes inspector, type some name in Back Button and hit enter to confirm. Open document outline and locate the viewController you were working on. On the left side of Navigation Item locate the disclosure triangle. Click on the Bar Button Item. Ctrl + click + drag the button to the navigation bar of that viewController. You can choose whether to place it on the left / right side.
I have four UITabBarItem's. Each has a label and custom icon. My AppDelegate uses the UITabBarDelegate protocol and every click on a tabbaritem is logged to the console so I can see what is happening.
The only way to select a tabbaritem is to click on the label. If I click anywhere else on the button area, including the icon, nothing happens at all.
Have you come across anything similar?
Well, I found the issue. Whenever a tab was clicked and a new view was programatically inserted, that view was placed on top of the tabbar, but since it's background was transparent I could not see it. So half of the tab bar was covered by another view. By making sure to bringSubviewToFront: the problem could be solved. Thank you everyone who tried to help.