Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS 8-导航栏按钮问题_Ios_Objective C_Uiviewcontroller_Ios8_Subview - Fatal编程技术网

IOS 8-导航栏按钮问题

IOS 8-导航栏按钮问题,ios,objective-c,uiviewcontroller,ios8,subview,Ios,Objective C,Uiviewcontroller,Ios8,Subview,我的应用程序有6个子视图的简单viewControll(XIB,无情节提要) 当用户单击按钮时,子视图显示在当前视图的前面(通过调用[self.view bringsubview tofront:usageView];) 应用程序在IOS 6和IOS 7上运行良好,但我在IOS 8上面临问题。 当我点击按钮使子视图在前面子视图像下面的图像 导航栏右侧按钮“完成”显示不正确,其隐藏仅在iOS 8中 请帮我解决这个问题,我是IOS开发新手。如果您需要更多信息,请发表意见。将此添加到此viewCon

我的应用程序有6个子视图的简单viewControll(XIB,无情节提要) 当用户单击按钮时,子视图显示在当前视图的前面(通过调用[self.view bringsubview tofront:usageView];) 应用程序在IOS 6和IOS 7上运行良好,但我在IOS 8上面临问题。 当我点击按钮使子视图在前面子视图像下面的图像

导航栏右侧按钮“完成”显示不正确,其隐藏仅在iOS 8中


请帮我解决这个问题,我是IOS开发新手。如果您需要更多信息,请发表意见。

将此添加到此viewController的viewDidLoad方法中,并根据需要进行自定义

 UIImage *backButtonImage = [UIImage imageNamed:@"Back_A.png"];
UIImage *backButtonImage1 = [UIImage imageNamed:@"Back_B.png"];

UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];

[backButton setImage:backButtonImage
            forState:UIControlStateNormal];

[backButton setImage:backButtonImage1
            forState:UIControlStateSelected];

[backButton setImage:backButtonImage1
            forState:UIControlStateHighlighted];

backButton.frame = CGRectMake(0, 0, 55, 45);

[backButton addTarget:self
               action:@selector(goBack)
     forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.rightBarButtonItem = backBarButtonItem;

使用框架,您可以在需要的位置显示按钮。

我已经输入了您的代码,但按钮无法显示。我用我的现有图像替换了图像名称。XIB中的“完成”按钮,我只是使用视图控件尝试从XIB中删除它并以编程方式添加它。我尝试了,但没有显示按钮。我从xib中删除了按钮,并将您的代码添加到ViewDidLoad中。您是否对帧的大小进行了“播放”??