Is there any way to prevent the default back button behavior in the navigation bar of a navigationview?
I'm trying to use Sencha Touch 2 history and linking abilities with routers, but that requires me to essentially intercept all button taps so that I can update the url.
The back button in a navigation bar creates all kinds of nightmares as far as thats concerned, and I can supply code if someone thinks they have an alternate solution, but preventing the default back button behavior seems best (so as to play nice with browser back button)
If you want to handle back button you can use back event of navigation view which fired when the back button of the navigation view was tapped.. Refer to my previous answer on how to do it.
If you want to completely hide the back button just simply use:
Ext.select('.x-button-back').hide();
try this Ext.getCmp('navigationview's id').getNavigatorBar().hide()
Related
I'm in some component where user can provide some data. If user clicks any button or swipes or do anything to navigate to some different Scene I want to detect if he provided some changes he didn't save and if yes, I want him to stay on the current screen, not navigate, and finally probably show some modal with warning. How can I achieve that with react-native-router-flex?
I've tried many approaches with onExit function f.e but failed to make any use of it...
I would like to have a small menu that closes if the user interacts with any other component. For example if the user tries to scroll or interact with any of the content in a scrollview behind the menu (see the image below for reference).
I have two ideas for how this might be achieved:
A transparent layer behind the menu with an absolute position and dimensions matching the device. If this layer registers a touch event the menu can be dismissed. The problem with this is that from the users perspective the touch event was totally ignored. So for this to work well I would need to be able to still pass the touch event through the absolute layer to the content behind it.
Add callbacks to every component that could be interacted with to notify the menu that it should close. This option seems like it would be very messy and because of the large number of components in my use case it is not practical to implement and maintain.
Is there an other proper way to solve this problem? Can any of the issues I raised with the ideas above be resolved or mitigated?
Wrap your view with a TouchableWithoutFeedback component and provide it a onPress callback that hides the menu if it's open. Depending on how top-level the 'expand' icon is, you may want to track the menu's visibility in redux and dispatch an action onPress to track globally.
I wonder if someone could help me please? I'm brand new to iOS and whilst I've been searching various sites for my answer, I'm afraid I haven't come across it yet but feel this could just be my naivety to the language so I apologise if this is a really simple thing...
I have a Tab Bar Controller with 3 views. On my first tab I have a button which when clicked, I want it to go to the 3rd tab (which is does). However, on the 3rd tab, I would like to insert a back button so that the user has the option of clicking back to go back to what is essentially the main menu of my application.
Can anyone tell me how I can do this please? I'm currently using storyboarding as I'm not very good with the language yet but any help would be greatly appreciated.
Thanks
Sean
You need to add a navigation bar to the view and set a bar button item with the action to change the tab.
Remember that a tab controller is standard across multiple apps, the user is use to tapping the tab to change the view rather than pressing buttons within the view.
It might be worth you looking into a UINavigationController
The first thing, you are implementing UITabBarController. you don't have to create a back button, because user can navigate between screens by tap on tab bar.
Second thing, you can use UINavigationController to manage you viewControllers,the Back button will automatically show when you push ViewController by method pushViewController:animated:
I'm developing an iPhone (iOS 5+) app using storyboards. The first screen of the app is a splash/login screen that checks for Facebook credentials and enables you to read and accept Terms And Conditions. In case there are valid stored credentials and the TOC has been previously accepted, this view automatically makes a modal segue (using a cross dissolve effect) to the first "real" application view, a tab bar controller with three tabs.
I'm currently implementing backgrounding and foregrounding logic. The problem is that when pressing the home button and then coming back, the login screen is briefly shown before the correct pre-backgrounding view is restored. (The Default.png of the app is of the login screen background, so it might be either that or a backgrounding-time screenshot of the actual login screen; I haven't tested replacing Default.png yet to tell the difference.)
Why is this? As far as I can tell, backgrounding the app should just take a screenshot of the view that is visible on the screen when, say, hitting the home button, and restore that prior to restoring the actual view functionality when coming back to the foreground. In this case that would be one of the tabs of the tab bar controller. Is the modal segue between the login screen and the tab bar controller the culprit here, or something else?
(I've always felt that the cross dissolve modal segue from the login screen to the first "useful" screen is a bit dirty, since IMHO a modal segue seems to imply that what your segueing to is something you'll later dismiss to get back to the "from" screen. What I'm doing now is just leaving the target of the modal segue visible indefinitely. If that is the problem here, I'd love it if someone would suggest a better method of displaying, transitioning away from and "jettisoning" the login screen.)
OK, turns out this was just a simulator/device discrepancy regarding Default.png. This comment on another question made me think to check. Time to file a bug report.
If I recall correctly, Apple has some old demo code which "remembers" which view a navigation controller was showing before it went into the background.
By way of disclaimer, I haven't worked with storyboards, so I don't know the specifics of doing what you're trying to do.
If it were me, I'd create the view controller or controllers at launch, and then only add the login screen if deemed necessary by the app delegate's logic. Only then, after setting up the view hierarchy, do I present everything.
This accomplishes two things. My login screen only exists and is visible if necessary. Additionally, the login screen won't flash unessecarily. Oh, and as a third benefit, you can present any view you like.
I'd suggest, assuming the aforementioned demo code doesn't work for you, that you'll want to save some sort of reference, tag, or ID of the currently visible view in NSUserDefaults and read that out when setting up your view hierarchy on launch.
How would make a Status Item when the actually button is clicked in the Menu Bar not in a drop down menu show or hide a window?
Sorry if this is a bit vague.
NSStatusItem supports the target/action mechanism like many other controls. I haven't used this myself -- I've only ever used an NSStatusItem with a menu attached -- so I don't know when the message is sent (i.e. when the mouse button is clicked or when it's released). If it doesn't do what you want by default, you would need a custom view like Daniel suggests.
To achieve this with NSStatusItem you need to create a custom view and replace the default NSStatusItem view by calling its "setView:" method.
You'll implement code in your custom view to react to mouse clicks by e.g. putting up a window. (You can use a button, or other standard views if it works best for you).
I'll warn you this is a bit tricky to get right. Lots of little nuances e.g. with getting the look of your custom view to look right in the menu bar. But this is the general approach you need to take if you want to override the default menu-prompting status item view.