Xcode5 iOS7 - UIPopoverController Corner Radius [英] Xcode5 iOS7 - UIPopoverController Corner Radius

查看:88
本文介绍了Xcode5 iOS7 - UIPopoverController Corner Radius的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个应用程序转换到相当流畅的iOS 7,有一点我无法弄清楚。

I'm transitioning an application to iOS 7 which has been fairly smooth, there's one thing I cannot figure out.

我有一个带有几个按钮的视图控制器我用UIPopoverController显示。

I have a view controller with a couple buttons that I display with a UIPopoverController.

在我看来,popover控制器正在做一些事情来剪切它的视图控制器的内容进行舍入。

It looks to me like the popover controller is doing something to clip the content of it's view controller to be rounded.

iOS6(我想要这个):

iOS6 (I want this):

iOS7(更改内容):

iOS7 (something changed):

我正在使用自定义弹出控制器这里描述的背景类 http://blog.teamtreehouse.com/customizing-the-design -of-uipopovercontroller

I'm using custom popover controller background class described here http://blog.teamtreehouse.com/customizing-the-design-of-uipopovercontroller

这是我背景类的特定版本 http://pastebin.com/fuNjBqwU

Here's my specific version of that background class http://pastebin.com/fuNjBqwU

有没有人有任何想法改变什么让它回到我的iOS 6外观?

Does anyone have any idea what to change to get it back to my iOS 6 look?

推荐答案

我试着让@ OneSman7的解决方案起作用,但是使用cornerRadius的视图不是contentViewController.view实例的直接超级视图。相反,我不得不走向视图层次结构,搜索其cornerRadius为0的那个并重置它(这只是一个UIView实例,没有要检查的特殊类名)。一个不太理想的解决方案,但似乎到目前为止工作。

I tried getting @OneSman7's solution to work, but the view with the cornerRadius wasn't the direct superview of the contentViewController.view instance. Instead, I had to walk up the view hierarchy searching for the one whose cornerRadius is no 0 and reset it (which is just a UIView instance, no special class name to check for). A less than ideal solution, but seems to work so far.

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        UIView *view = self.view;
        while (view != nil) {
            view = view.superview;
            if (view.layer.cornerRadius > 0) {
                view.layer.cornerRadius = 2.0;
                view = nil;
            }
        }
    }
}

这篇关于Xcode5 iOS7 - UIPopoverController Corner Radius的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆