UINavigationController bar button Trigger - uinavigationcontroller

How can I trigger when a bar button is clicked in UINavigationController?
As I need to reset the image in the details view when the bar button item "Back" is clicked.

Question is a bit vague. 2 possible answers.
Link the bar button item in IB to a method in your view controller object that does the reset when clicked.
I assume you want to reset something when the view controller unloads or disappears. You will want to see -()viewdidunload. http://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

Related

what is the solution for show different pop up with same button?

i have a choice list with different action (add file or add comment) and a button OK.
The button will show pop up according to action select. My question is how i do this in same button?
I create two pop up's but i don't know how to invoke them after.
You could change the text on the button per pop up window. Then when the button is clicked, pick your pop up based off of the text on the button. For example, initial state of the button says open, then when its clicked you display a pop up and change the button text to close. Then when the button is clicked again you close the window and change the button text to open.

QML: redraw TableView when context menu shown

I show context menu when user right clicks on row at TableView and select clicked item:
downloadContextMenu.popup()
tableView.selection.clear()
tableView.selection.select(row)
but TableView show selection only if I will move mouse to something else (i.e. button) after it. So, how to update TableView in this case?
downloadContextMenu is Menu
P.S. If I will do it by this:
tableView.selection.clear()
tableView.selection.select(row)
downloadContextMenu.popup()
I will have the same problem, but after next opening of context menu (open menu, then click outside to close it, then open again)

Storyboard UINavigation Controller Back Button Text

In XCode 4.5.1 creating a storyboard app with a Navigation controller, I am having a hard time trying to set the BACK button for any view controllers that are pushed. I'm using segue's and the view controller shows as expected. However I want to change the name of the navigation bar and back button dynamically and placed this in my ViewWillAppear:
self.title = #"Select Songs";
[self.backButton setTitle:#"Add"];
changes the title of the navigation bar but the back button still displays the NAME of the pushed window rather than the text "Add".
The Simulated Metrics are all Inferred. I also added a BarButtonItem to the black tray below the view in Xcode and wired up the backButton of the viewcontroller to the backButton, yet the text still does not appear.
Adding the following log messages also yield something interesting: (and yet the titlebar is updating correctly)
-(void) viewDidAppear:(BOOL)animated {
NSLog(#"%s %#", __FUNCTION__, self.navigationItem.backBarButtonItem);
NSLog(#"%s %#", __FUNCTION__, self.navigationController.navigationItem.backBarButtonItem);
}
2012-10-14 15:18:41.835 xxxx[2690:907] -[ViewController viewDidAppear:] (null)
2012-10-14 15:18:41.838 xxxx[2690:907] -[ViewController viewDidAppear:] (null)
The accepted answer is a hack, this is the way to do it...
Open StoryBoard
In Document Outline window find ViewController to which you want to
return to
Click on Navigation Item of that ViewController
In Attributes explorer change Back Button value to your custom tile
That is it, enjoy...
The back button will show the title of the previous view and if no title is set it'll show 'Back'.
So in your prepareForSegue method, you can change the title of the current view before the next view is pushed. The back button will then show whatever you set the title to.

How to identify the viewcontroller is clicked from More Tab or Separate tab in UITabBarController?

I have the navigationcontroller based viewcontroller and I overriding the root view controller navigation bar back button in to my custom segment control with different purpose. This navigation controller is placed one of the separate tab in the uitabbarcontroller. If this is used as the separate tab bar then no problem.
But if i use this navigationcontroller inside the more option in tabbarcontroller i am not able to come back to the more option list because of backbutton is overridden in my navigationcontroller.
My idea is add one back button only if my navigationcontroller is used more option tab otherwise i need to hidden the back button.
Please help me in this issue?
You can check if a view controller is in the 'more' section as follows:
BOOL isOnMoreNavigationController = [tabBarController.moreNavigationController.viewControllers containsObject:myViewController.navigationController];
From a UI consistency perspective it might be better to always show the back button in its standard position and move your custom buttons to some other place.

Flex - Menu Created On Button Click

I created a Button in MXMXL. On button click, I create a Menu as a child of the Button. I am using an XML datasource. The reason for creating it this way, was due to the amount of custom skinning involved. A popupmenubutton was not an option. Anyway, so my question is this: when clicking the button, the menu is displayed. However, if you click the button again, the menu reopens. I want the menu to close if the user clicks the button a second time. Now, I got it to work by setting a var after opening the menu, and then I check that var on each click to make sure that the menu isn't already open. If true, then it will close the menu, instead of reopening it. This works, until the user clicks away, in which the HIDE event gets dispatched and the menu closes. My hack no longer works.
Any suggestions? I spent hours trying different things. The hardest part is trying to destinguish from that second button click when the menu is open, and when the user clicks away from the menu. They both dispatch the HIDE event.
Help!!!
Have you tried adding another eventlistener to the button...FlexMouseEvent.MOUSE_DOWN_OUTSIDE ? You should then be able to set the preventDefault event to true to stop the event from firing anything else and stop the menu from closing.

Resources