iOS Custom Image for Navigation Back Button - uinavigationcontroller

I am trying the following code in viewDidLoad{} to supplant a custom 'home' button where the stock 'back' button in the nav controller is for two views.
UIImage *image1 = [UIImage imageNamed:#"btn-home-hd.png"];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:image1 forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
Problem is, the word 'Back' is still showing up under the new image. The image is a lil house so we just want that image to show up, nothing under it. I tried putting a blank space in for 'back button' for this particular view in the storyboard
I see lots of articles with this code in it, but no one is mentioning that the word 'back' is still showing up... why? Does this code need to be further upstream in some init somewhere?

I don't know if this is the recommended strategy, but the way I've solved this is to move the text offscreen. E.g.
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-100, -100) forBarMetrics:UIBarMetricsDefault];

Related

write tool-tip that can be invoked for ay html element. should consist of 3 elements title, content, Okay button

I really need help. I am unable to find any examples to this particular problem. I have spent many hours and really want to give up. We have never covered this in the program I am in and I really do want to learn even how to begin. I spent 5 plus hours working on this and came up with a solution that worked but since it did not follow all rules it was not accepted. We have not covered tooltips so I’m not sure how to go about this.
The question is to write a tool-tip that can be invoked for any html element on a given page. The preferred position can be viewed left right or bottom of html element. Should contain title, Content, Okay button that will dissolve after user clicks the okay button.
api to be used is
$('#HTML element').showToolTip ( {
Title: 'This is the title'
Content: 'This is the content'
onApprove: function() {
//to be called after Okay button is clicked.
}
} );
showToolTip is a jQuery plugin to create a tool-tip-style alert popup which can be attached to any element when triggered.
It provides a callback function which will be fired when the user clicks on the Okay button inside the alert popup.
The plugin grabs dimensional information about the popup, host element and the viewport width and height to calculate in which direction to show the alert popup. For example it automatically re position the alert popup if TOP, RIGHT, BOTTOM, LEFT doesn't have enough space.
Visit this link to see how to use

Xamarin form Navigation page back button not displaying

I need to add a back button to my navigation page. I tried NavigationPage.SetHasBackButton(page, true); but it didn't work and I tried in xaml also, still does not work. Can anybody help me?
Your code isn't right. In App.xaml.cs you need to set Main page to be new NavigationPage(new ProductDetail());
Then when you navigate away from ProductDetail, you will see the back button.
Also normal page navigation will use PushAsync. Are you wanting a modal popup for your second page?

ios7 new pan gesture to go back in navigation stack does not clear tableview selection

I have a Notes-like app: uitableviewcontroller showing up individual notes by pushing them onto navigation stack). And I decided to use an ios7 Back button and a pan gesture recognizer coming with it.
My only modification is removing text from the button by setting navigationItem title of the from-controller to an empty string before pushing the detail-view-controller, as it is advised at https://stackoverflow.com/questions/18870128/ios-7-navigation-bar-custom-back-button-without-title
The button itself works just fine, but when I am going back from my note to the notes table view by means of the pan gesture, tableview selection is not cleaned! The row of the note I've just transitioned from is still shown as a selected one.
Any ideas what could be wrong here?
I've checked the standard Notes app and it works like a charm.
This answer did help me: https://stackoverflow.com/questions/897071/iphone-uitableview-cells-stay-selected
- (void) viewWillAppear:(BOOL)animated {
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
[super viewWillAppear:animated];
}
At least for the cases we were seeing this happen, it seems to be fixed in iOS 7.0.4. (We've actually noticed that a number of glitches with the back gesture have been fixed during the 7.0.x releases.)

How to customize default back button in UINavigationView ios7

I am using Navigation View Controller in storyboard to creates different views linked together by segue link. Therefore, all the back button are automatically created.
I have tried many ways to customize that back button with other text, or just no text but still cannot.
Here are the methods I tried,
self.navigationItem.backBarButtonItem.title = #"abc";
or
self.navigationController.navigationItem.backBarButtonItem.title = #"abc";
or
self.navigationItem.title = #"abc";
Please help me this one, thank you a lot :)
You can edit the back button's title in storyboards directly. Select the appropriate ViewController that's been imbedded in a NavigationController and then:

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.

Resources