I've added a UIBarButton However, I'm not able to display a title.
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0, 5, 30, 30)]; [Button addTarget: Self-action: @Selector (doneButtonClicked :) forControlEvents: UIControlEventTouchUpInside]; UIBarButtonItem * customItem = [[UIBarButtonItem alloc] initWithCustomView: button]; Self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = customItem;
I tried the following:
button.title = @ "title";
and
customItem.title = @ "title";
There is not much you need to do, just do it:
UIBarButtonItem * customItem = [[UIBarButtonItem alloc] initWithTitle: @ "Title" Style: UIBarButtonItemStylePlain Target: Auto Actions: @selector (doneButtonClicked :)]; Self.navigationItem.rightBarButtonItem = customItem;
Hope this helps .... :)
No comments:
Post a Comment