Ios 创建导航栏的粘滞视图
我如何创建一个UIView,它像这样粘贴到导航栏上。在该图像上,即使您滚动,该图像仍将显示: 你可以试试这个Ios 创建导航栏的粘滞视图,ios,objective-c,iphone,swift,Ios,Objective C,Iphone,Swift,我如何创建一个UIView,它像这样粘贴到导航栏上。在该图像上,即使您滚动,该图像仍将显示: 你可以试试这个 [self.navigationItem setTitle:@"Vijay"]; UIImage *image = [UIImage imageNamed:@"tabarrrr"]; [self.navigationController.navigationBar setBackgroundImage:image forBarPosition:UIBarPositio
[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;