开发者

Change "back" NavigationItem text in Monotouch?

Is it possible to change the "Back" button text in a NavigationItem? At present, the caption of the back button assumes the title of the previous layer in the navigation stack, which is expected.

However, the NavigationItem's LeftBarButtonItem can be changed using code such as this:

UIBarButtonItem backButton = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null);
myNewView.NavigationItem.SetLeftBarButtonItem(backButton, true);

This works and the back button is displayed as expected, but the button is a square and does not navigate back to the previous layer as expected. I'm guessing that the correct event needs to be assigned to it, but I have no idea what it should be.

How would one go about ensuring that the new UIBarButtonItem has the correct event and arrow shape?

Note: I have also开发者_Go百科 tried re-using the `LeftBarButtonItem' as suggested in this SO question, but I still don't know how to customize the button caption. I am probably just missing the obvious.

Thanks!


Set the title on the previous viewcontrollers navigationitem. I answered this before and will look up the link.

Ah, yes: Separate title in NavigationBar and navigation buttons

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜