导航栏上的自定义图像无边框

时间:2013-02-12 22:11:05

标签: objective-c xcode

The way the barbutton looks in first view

我正在尝试创建自定义条形图项,如边框所示。我做了它,但在下一个视图中它有一个不同的右栏按钮项,并且前面的右栏按钮项重叠。谁能帮帮我吗。

the way the barbutton of first view overlapping the barbutton item of next view

代码如下:

`UIButton * refreshButton = [[UIButton alloc] initWithFrame:CGRectMake(285,9,27,27)];

[refreshButton setImage:[UIImage imageNamed:@"Refresh_Icon.png"]   forState:UIControlStateNormal];

[refreshButton addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventTouchUpInside];

[self.navigationController.navigationBar addSubview:refreshButton];`

1 个答案:

答案 0 :(得分:0)

尝试设置self.navigationItem.rightBarButtonItem = NO;在VC的viewDidLoad方法中。