I have some navigation bar in my UI
of iphone app. Now i want to add two images on the navigation bar on center of the navigation bar..
I have successfully added the two UIImageView
on the navigation-bar but my problem is that i have two UIImageView
with the label on it ..
Let me show u the snapshot ...
now my problem is i don't know how to add this kind of label near UIImageView
in navigation bar..so please if anyone can guide me for this then it will help me a lot..
i have already successfully inserted two images on navigation bar with this Code.
UIImageView *Messageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed :"message.png"]];
Messageview.frame=CGRectMake(10, 0, 40, 40);
UIImageView *BirthdayView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:"birthday.png"]];
//titleView.frame=CGRectMake(60, 0, 50, 50);
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[flexible setWidth:20];
UIBarButtonItem *flexible1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[flexible setWidth:20];
UIBarButtonItem *MessageBtn=[[UIBarButtonItem alloc]initWithCustomView:Messageview];
UIBarButtonItem *BirthdayBtn=[[UIBarButtonItem alloc]initWithCustomView:BirthdayView];
self.navigationItem.rightBarButtonItems=[NSArray arrayWithObjects:rofileBtn,flexible,BirthdayBtn,MessageBtn,flexible1,nil];
Please Guide me as soon as possible..
I think this would help you.
possible duplicate. see here. It seems you need to inherit
UIBarButtonItem
and create your own custom view with aUIButton
with a subview of the badge you need to add. Hope it helps.Please use this
Please use this code by setting the frame according to you images. Because you have already added images to your project, just put the label next to them wherever you want.
Hope this helps.