当前位置: 代码迷 >> Iphone >> 怎么代码实现自定义 UINavigationBar
  详细解决方案

怎么代码实现自定义 UINavigationBar

热度:42   发布时间:2016-04-25 06:08:47.0
如何代码实现自定义 UINavigationBar
请问 : ?如何代码实现自定义的UINavigationBar:


我打算 继承 UINavigationController ?重新初始化 _navigationBar.


似乎语法不允许。 便宜不通过。


网上找了一些例子都不好用。实现的都比较简单,不是我的需求。




我的需求:


title: 是一个image。


back button 是自定义button(image)


forward button 也是自定义button


背景是全透明的


我是一名新手,请大侠门指点一下。 ?已经baidu 和google 了好多。


有人说用three20 ,目前开不打算这么搞。总是认为 ios 开发,这种简单的实现,应该有简单的方法。


我做过symbian android ,实现这种效果,都很简单。

------解决方案--------------------
自定义1个view  在view里添加你需要的控件

UIView* MyToolView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];    
UIBarButtonItem *UIBarBtn = [[UIBarButtonItem alloc] initWithCustomView:MyToolView]; 
[self.navigationItem setLeftBarButtonItem:UIBarBtn]; 
    [UIBarBtn release];
    [MyToolView release];