I am working on one app in which I have to display app's status on the UINavigation Bar. I am going to use UILabel to display the status. I was wondering whether it is possible or not ?
Regards, Sumit
Yes. The things to do are
UIView
) which contains all your labels.
UILabel
directlyUIBarButtonItem
with the help of initWithCustomView:myLabelsView
setRightBarButtonItem:animated:
with your UIBarButtonItem
-instance on [myViewController.navigationController.navigationItem setRightBarButtonItem:myBarButtonItem animated:NO]
Example:
-(void) viewDidLoad {
....
UIView *myNiceLabelView = [UILabel ...];
UIBarButtonItem *myBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:myNiceLabelView];
[self.navigationController.navigationItem setRightBarButtonItem:myBarButtonItem animated:NO];
....
}
I don't like to see crazy user interfaces (and I don't think your users would like it either -- there isn't all that much real estate or space to work with in the navigation bar), but the technically correct answer for you here is yes you can:
Create a view with multiple labels (or whatever you want) embedded in it and set your UINavigationItem
's titleView
property to that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With