how to get previously selected tab after dismissing modal IOS - uitabbarcontroller

I have an application using UITabBarController. There are 5 tabs (tab1, tab2, cameraTab, tab3, tab4). When user taps on middle tab , the modal view will appear hiding the TabBar (in my case camera - UIImagePickerController). If user then taps on cancel button on that modal view, how do I make it to return to previously selected tab. For example: if i am on tab2 and I tap on the camera tab, modal view appears and then I tap on cancel, how do i return back to tab2 automatically. The same goes for all other tabs, if I'm on tab3 it should return to tab 3 and so on. Right now it remains on camera tab without modal view - just blank view with background image.
I'd really appreciate if you can help me with some examples. I've been searching in various ways - there must be a way that UITabBarController keeps a record of previously selected tab.
Thank you

Personally, I think you should create a custom view where the middle camera tab would not be a tab at all, it would actually just be a button that presents the modal view and then that view would have a button to dismiss it. I would do a little research in http://idevrecipes.com/ to see if there is anything there. If not, maybe github. The tab bar itself is looking for views to push, not present.
I am sorry I couldn't give you more of an answer, but I wanted to give you something for waiting so long.

Related

Programmatically activating swipeActions in a List (Similar to alarms in Clock and lists in Contacts apps)

I was looking to replicate the functionality contained in the native iOS Clock and Contacts apps for list items. After pressing "Edit" at the top right, red "minus" circles appear on the left side of each list item. If you press the minus sign, it "swipes" the list item to the right and shows the "Delete" swipeAction:
Contacts Groups List View
Contacts Groups List Edit View
Contacts Groups List Edit View - Swipe Action Active
I can set the swipeActions for a list item easily, and can replicate the edit button. As well as adding the minus buttons when editing the list (I used an HStack with a Button and Text view inside). What I cannot find anywhere is how to have the button action show the swipe action. All related posts comment on having the button action closure run the code that a gesture would typically activate. From what I understand, the gesture handling is done inside of SwiftUI itself for swipeActions, and I cannot find a way that you could imitate the result. Would this be something that would have to be done in UIKit? Or would I have to build a custom version of swipeActions to implement the same feature?
I have tried researching imitating gestures on Views, but everything seems to say it is not possible to do so

apex5.0, disable button when another button is clicked

How to disable a button in oracle apex if another button is clicked.
I have buttons in a classic report.
btn1: Update
btn2: Delete
btn3: Save
I would like when one of the button is clicked, the others buttons should be disabled.
Pls advise how to do that
What happens when one of the buttons is clicked? Knowing this could provide a better way of doing what you want, such as with a server-side condition.
Not knowing this, you could do it with dynamic actions - on button click of particular button, disable / hide the other buttons (set multiple true actions). You would also want to specify when to reset them.

How to navigate to another view controller in the same tab of the tab bar controller in swift 3?

I have a tabbar in my app and in one of the tabs I want to navigate to another view controller - I know how to navigate But the problem is when I used that I can't see the tab bar in the bottom that means I can't go to the other tabs when I navigate
Hard to answer without a visual but it sounds like your hierarchy is off. Make sure any content like background images aren't above the nav bar in your view or else it will block the nav bar when you run the app.

How to expose standard back button in view controller navigation?

I need users to be able to navigate a data hierarchy (master level, detail level) and to create new master and detail objects accordingly. Both master and detail use arrays for their model and TableViews for presentation
The navigation flow for this uses 2 navigation and table controllers like below. The + of the master and detail TableViews create new objects, the forstTableCell navigates to the second TableView using a segue:
While the screenshot shows "Done" right now even when removing that ButtonItem the slot remains empty.
I would like to show the standard back button instead: "< Middlewares" in this case. In the tests I've only been able to get the back button when navigating to a normal ViewController, but not to another NavigationController. Is it possible to have it between Navigation Controllers, too?
Simply remove the second navigation controller. If you use a push segue, your second view controller will still have the navigation bar. As long as you don't use a modal segue all view controllers that are pushed will have a navigation bar.
So your storyboard will look like this:
You will then automatically have a back button. If you want to change the text of it, go to your navigation item of your first view controller and change the back title accordingly as shown in this screenshot
You certainly want to have a title in your second view controller (something like "Add [whatever you want to add]". So simply drag & drop a UINavigationItem on your second view controller then you can also add UIBarButton items in your Interface builder
Controlling the look/feel of the Navigation Bar Buttons
You can achieve the behavior you want by opening the Document Outline and find the existing Done button. If you have a UIBarButtonItem type, you can simply change the type to Custom in the Inspector. Next add a regular button within the UIBarButtonItem (just bring the Navigation bar for the target controller into the zoomed in view of the storyboard/xib). This will allow you to drag a button onto the navigation bar.
Once you have a standard button you can add an image with the back arrow. Then add supporting code to use the pop behavior on the Navigation bar. Since you can have only one root navigation controller, you may want to remove the second UINavigationController and add a UINavigationItem from the objects library and then subsequently add the buttons, titles of your choice. This configuration will allow you to leverage all of the push and pop methods available, while retaining full control of the look/feel/behavior of the navigation stack.
More on customizing the look/feel/behavior of the UINavigation Stack can be found at: Navigation API Docs

How to show a ‘modal’ view (controller) *in* a tab bar interface without hiding the tab bar

I want to implement a ‘modal’ view like the ‘search’ view of the AppStore on the iPad.
When shown, it should:
Still show the tab bar. Selecting any of the items should take you to their view as normal.
No tab bar item is highlighted (because the search view is ‘modal’).
The closest I’ve come, with existing APIs, is:
On the ‘search’ view controller, set the UIModalPresentationCurrentContext modal presentation style.
Show ‘search’ view controller modal from the active view controller inside the tab bar controller (not from the tab bar controller itself).
However, this does not seem to be the right path:
View controller is shown underneath the status bar. I can work around that from -[UIViewController viewDidAppear:], but when changing the orientation of the device, this leads to all sorts of drawing issues and the controller, again, tucks itself underneath the status bar.
Tab bar item is still highlighted.
to keep showing the search bar just trim the modal view's hight so that it doesn't cover the tab bar.
For orientation changes, you just need to handle that by changing the view size and making sure the modal view is always brought to the front of all the views. You can modify that view's frame and contents programmatically or you can just create nibs for the orientations you want to support and load them up when it changes. Also note if you do change the view's frame programmatically you will probably need to resize/reposition fields as well.
For dealing with the tab bar, you should be able to turn off the highlighted item. So when you pop up the modal also make sure to turn off the highlighted item. If you want to interact with the toolbar from the modal view you can do that with delegates, passing an instance of the parent view (or just accessing parent view... I think you get that for free)