How to add two buttons to the UINavigation bar title view
can any body help me how to add two buttons to the navigation title view
by using the title view property. I tried but, able to add only one button
by using the following code.
UIView *cusotmView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
cusotmView.backgroundColor=[UIColor redColor];
UIButton *b1=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
UIButton *b2=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
[b1 setTitle:@"Hai" forState:UIControlStateNormal];
[b2 setTitle:@"Hello" forState:UIControlStateNormal];
[cusotmView insertSubview:b1 atIndex:0];
[cusotmView insertSubview:b2 atIndex:1];
self.navigationItem.titleView =cusotmView;
No comments:
Post a Comment