导航栏上的TwoRightBarbutton图像一个是动画搜索,第二个是菜单

时间:2015-12-17 11:55:09

标签: ios iphone

如何在iOS中的导航栏按钮上添加动画搜索栏按钮和菜单按钮?

enter image description here

1 个答案:

答案 0 :(得分:0)

使用行动方法

UIBarButtonItem *menu = [[UIBarButtonItem alloc]initWithTitle:@"Menu" style:UIBarButtonItemStylePlain target:self action:@selector(menuPage)];
UIImage *menuimage = [[UIImage imageNamed:@"menu.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[menu setImage:menuimage];

self.navigationItem.leftBarButtonItem=menu;

UIBarButtonItem *search = [[UIBarButtonItem alloc]initWithTitle:@"Search" style:UIBarButtonItemStylePlain target:self action:@selector(Searchpage)];
UIImage *searchImage = [[UIImage imageNamed:@"search.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[search setImage:searchImage];

self.navigationItem.rightBarButtonItem=search;