我将返回和下一个按钮设置为导航栏项目左按钮和右按钮。下面的代码为
// Back Button
UIBarButtonItem *aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];
[aButton addTarget:self action:@selector(navigatehome)forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = aBarButtonItem;
//Next Button
aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];
[aButton addTarget:self action:@selector(navigatenext)forControlEvents:UIControlEventTouchUpInside];
[self.navigationItem setRightBarButtonItem:aBarButtonItem]
animated:YES
声明中的问题
CSA_info *h1=[[CSA_info alloc]init];
[self.navigationController pushViewController:h1 animated:YES];
它显示如下图
如果使用animated:No
则显示如下
我在导航栏中添加一个图像作为子视图,因此它隐藏了按钮。
UIImage *image = [UIImage imageNamed:@"title bar.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(-5, 0, 330, 44);
[self.navigationController.navigationBar insertSubview:imageView atIndex:2];
我需要在导航中添加该图像。
为什么会这样,有什么帮助吗?