ios中导航控件中的自定义工具栏不显示按钮文本(在这种情况下添加按钮+和编辑按钮文本)

时间:2014-03-10 09:07:45

标签: ios iphone

//Adding Right Bar Add Button
UIBarButtonItem *addBarButton=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertData)];
//self.navigationItem.rightBarButtonItem=addBarButton;


 UIToolbar *toolBar=[[UIToolbar alloc] initWithFrame:CGRectMake(160.0,20, 150, 30)];
 toolBar.barStyle= style
 toolBar.tintColor=[UIColor clearColor];
 toolBar.backgroundColor=[UIColor clearColor];
 NSArray *items=[NSArray arrayWithObjects:addBarButton,self.editButtonItem,nil];
 [toolBar setItems:items];
 UIBarButtonItem *barItem=[[UIBarButtonItem alloc]
 self.navigationItem.rightBarButtonItem=barItem;
 self.navigationController.toolbarHidden=YES;

1 个答案:

答案 0 :(得分:0)

您的代码中存在错误。

删除此行或给它一些其他颜色。

toolBar.tintColor=[UIColor clearColor];

或将其更改为

toolBar.tintColor=[UIColor blueColor];

这解决了你的问题。