How can I dismiss the view appeared by touching Add item in UINavigationController? - iphone

I have added add(+ symbol button) button to my navigation controller.
When I click it a view appears from bottom. I added a navigation bar and two buttons to it.
One save and one cancel button. And the view have one textEdit box. After editing I can save or cancel. If I touch cancel I need the view to disappear like it should go down again.
I think all iPhone , iPodTouch users use it. Like when they touch Add item then a view appears from bottom and when they cancel it goes down again. How can I make in this way in my application.

Maybe you're talking about a UIActionSheet?!?
http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html

Related

Programmatically hiding a view controller from a tab bar application

I am working on a tab bar application. Is there a way I can programmatically hide one view controller from the scroll down list and from the "edit" list (but still be able to pop it on screen with a certain action, i.e. by calling its tabbarcontroller index)?
The problem is that I have now so many viewcontrollers that completely fill the "edit" screen. So I want to hide some of them and be able to trigger the hidden ones trough some action performed on one of the visible ones.
Thanks

Won't add navigation item to navigation bar in xcode

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.

NavigationBar Right Button Problem

I have a navigation bar in my app. The below pictures are in the order of navigation.
Problem I have is, on clicking the "Main" button , I am able to perform the action and goto the required screen , but the navigation bar does not look like the first on (with Menu as left button). Instead it look like 4th image. How to make it look like first image so that I can make the user to navigate to "Menu" screen by clicking menu button ?. Thanks for the help …!!!
If I'm understanding this correctly, you may have pushed the first view controller (The one from screenshot 1) when clicking on main which is why you see "lens" in the back button. That back button takes the title of the previous view controller in the stack. What you want to do is pop to the first view controller when they click on Main using either popToRootViewController or popToViewController:animated

Add a custom back button to Navigation Bar using MonoTouch

Just want to confirm this, as I'm trying to learn monoTouch alone..
I have a view which I navigate to using NavigationController.PushViewToController(). On the destination view, I have a Navigation Bar. I can add a button to the bar and use code to push to another view (I happen to know where Back is), fine.
Is there a existing "back button" control? Or a way in to code to change the existing back button to say "Go back"?
In Interface Builder I can see there is a property on the navigationItem called "Back". When I add text to this I can see a new BarButtonItem added to the navigationBar. However I never see this button when I navigate to the view in the simulator. If I try to drag the item onto the view manually, the "Back" text is cleared and the button is treated like a custom button.
Do I always have to manually code the back button?
The default back button (the one that takes the name of the previous controller) cannot be customized. But you can hide it and replace that button with a new one.
If you have a controller, you can do that on the viewDidLoad method. Overriding this method you are sure that all the elements have been set.
// allows you to hide the back button
NavigationItem.SetHidesBackButton(true,true);
// allows you to create a new customized button
NavigationItem.LeftBarButtonItem = new UIBarButtonItem(...);
UIBarButtonItem takes an handler that you can use to control the navigation.
In the handler you can do this:
NavigationController. PopViewControllerAnimated(true);

Remove UISearchBar on tableView click

I have a UISearchBar which is subviewed by another view when a button is pressed. When it loads, it looks like the following (minus the red scribbles):
I would like to have the UISearchBar view be removed from the parent view controller when the tableView (the area with red scribbles) is clicked and is empty (no search has been made yet). I'm having a difficult time figuring out the best way to do this.
I have tried to put a transparent button in that section and add it as a subview to the search bar. However the button is underneath the tabl view area, so when the table view is clicked, the search bar loses focus and the uibutton is only then accessible.
Does anyone know how I can remove the search bar from the parent view controller when the empty table view below it is clicked?
Thanks.
To bring the transparent button up and make it catch all touched first, use [button.parentView bringSubViewToFront:button].
Another approach could be to catch the search bar losing focus (since you say you see that happening), by putting
– (void)searchBarTextDidEndEditing:(UISearchBar*)searchBar
in the search bar delegate, and handling it from there.