如何创建一个像这个图像一样粘在导航栏上的UIView。在此图像上即使你滚动它仍然会在那里:
答案 0 :(得分:0)
您可以尝试此
[self.navigationItem setTitle:@"Vijay"];
UIImage *image = [UIImage imageNamed:@"tabarrrr"];
[self.navigationController.navigationBar setBackgroundImage:image forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:image];
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
[self.navigationController setNavigationBarHidden:FALSE];
[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
//
// UIBarButtonItem *RigthButtonClicek=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"search.png"] style:UIBarButtonItemStylePlain target:self action:@selector(RigthButtonClicek:)];
UIButton *button1=[UIButton buttonWithType:UIButtonTypeCustom];
[button1 setFrame:CGRectMake(10.0, 2.0, 40, 20.0)];
[button1 addTarget:self action:@selector(RigthButtonClicek:) forControlEvents:UIControlEventTouchUpInside];
[button1 setImage:[UIImage imageNamed:@"cancelbtn.png"] forState:UIControlStateNormal];
UIBarButtonItem *button = [[UIBarButtonItem alloc]initWithCustomView:button1];
self.navigationItem.leftBarButtonItem = button;
UIButton *button2=[UIButton buttonWithType:UIButtonTypeCustom];
[button2 setFrame:CGRectMake(10.0, 2.0, 40, 20.0)];
[button2 addTarget:self action:@selector(RigthButtonClicek:) forControlEvents:UIControlEventTouchUpInside];
[button2 setImage:[UIImage imageNamed:@"search.png"] forState:UIControlStateNormal];
UIBarButtonItem *button3 = [[UIBarButtonItem alloc]initWithCustomView:button2];
self.navigationItem.rightBarButtonItem = button3;