I have an application where if I press a button I will go to maps, I was able to do that, and in my map view I have a toolbar which has a button "back" which is supposed to get me back to the previous view, however I'm having difficulties doing that because I can't seem to find an appropriate function to do it, or maybe I missed, Its my first time working with maps and multiple views for an iOS app. Can someone help me please with how to do it?
Thanks
You just want to dismiss the view controller.
If you're presenting the map modally, have the back button call a method that performs:
[self dismissViewControllerAnimated:YES completion:nil];
Related
I am trying to allow the "Swipe to go back" feature found in iOS 7+, but it isn't working in my app. I have added
nc.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
[nc.interactivePopGestureRecognizer setEnabled:YES];
but it simply refuses to work. I have a navigation controller at startup and then I have the "present as popover" segment from view to view. Is there any way I can get an error message or an NSLog to detect why it isn't working?
No code changes should be necessary for this feature. If you push a view controller onto a navigation stack, it should just work. Rather than trying to figure out the code to make it work, you'll need to find out what you did to break it.
This feature is designed to work with view controllers pushed onto the navigation controller. You shouldn't use "Present as Popover" for that. If you're setting up a segue in IB, just select the Show option. Popovers aren't dismissed with a Back button.
Is there some way to add a button (not in a navigation view or something like that) that will perform back (meaning, going back to the previous view before the last segue) in an iOS app?
It doesn't have the shape of a back button (it will be fine with simply the word "Back" on it).
I want to put something like that in a bottom toolbar.
Thanks.
Just put a simple button and in its action do:
[self.navigationController popViewControllerAnimated:YES];
I am using custom popover controller(WYPopoverController) for iPhone and showing UIReferenceLibraryViewController in it. The view does come perfectly but UIReferenceLibraryViewController has 'Done' button on its navigation bar and when I click on it, it does not respond. Though if I click outside the popover then popover disappears. I simply want to disappear popover when 'Done' button is pressed.
Please note, if I use UIPopoverController for iPad, then 'Done' button in UIReferenceLibraryViewController does respond. Not sure what am I missing in custom implementation.
Any help is much appreciated.
The problem to me seems like part of a terrible design by Apple, where the reference library controller dismisses itself rather than providing a delegate method notifying you to dismiss it. First, open a bug report with Apple and post the bug report number so people can duplicate it.
In absence of better options, I would suggest replacing the controller's navigation item's bar button item with your own, where that button would notify you of the user's tap and you'd dismiss the controller properly. This is a partial solution, as the reference library controller is a complex case, where it maintains a navigation stack internally. You may have to dig in the view controller parent/child hierarchy to find all cases.
Consider changing your design in the meantime, presenting the view modally instead of a popover on phone/pod devices.
I have a slide out menu in my app and each of the things in the menu goes to the respective pages.
Basically, when I tap "graph section" on the dashboard, I want it to go to the graph page without the Dashboard back button.
I've tried doing this with a modal segue but this provides a back button which means I can't access the menu on this page.
Anyone know how to do this?
I am not quite sure whether this answers it but have a look at:
Open View Controller programmatically and not using a Seque
I think you Use navigation controller.Once you hide the navigation controller for that particular page with [self.navigationController setNavigationBarHidden:YES]; and add UIButton and write it's action
I am using UIAlertView to let the user know some information, I have a button on the AlertView that when clicked triggers a whole new view to be shown.
The pseudo code run when the button is clicked is:
Find my UIViewController, and initiate the veiw controller for my new view, and call presentModalViewController:mySecondView animated:Yes
And this works fine..
On mySecondView I have a button that I use to dismiss the view using dismissModalViewControllerAnimated:YES
Now, the transitions work, I click on the UIAlertView Button and the SecondView appears, and when I click on the Exit Button my original View appears, unfortunately it appears without the ALERTVIEW that started the transition..
I want the first view to reappear with the AlertView still visible, after all the user did not dismiss it. So, what is the best way to go about this? Have the button simply load the veiw from a nib, and add it to the subview of the parentview of alertview, and then hide it when the exit button is pushed? Seems kludgy and boring, but I assume this would work...
Store the fact the alert view is visible in a modal variable, and on the ViewWillAppear check the modal, and then redraw the UIALERTVIEW? This seems like a memory leak to me, since the original view was never explicitly released...
I got to believe there is a more elegant solution... any ideas anyone?
Well, in the end I just wound up just recreating the alert view after the secondary view was dismissed. I can't say I'm crazy about it, but it does provide the behavior I need without lots of hacking.