ios 7 - IB的透明度无法正常工作?以编程方式设置透明度也不起作用? [英] ios 7 - transparency in IB not working correctly? setting transparency programmatically also isn't working?

查看:148
本文介绍了ios 7 - IB的透明度无法正常工作?以编程方式设置透明度也不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IB中创建了两个UIViewControllers。

I have created two UIViewControllers in IB.

问题1:我不能让2. VC透明。
我已经阅读了很多stackOverFlow解决方案但在我的情况下似乎没有任何工作。
我在IB当前项目和这个简单的项目中尝试了以下设置,并且发生了一些奇怪的事情(IB,for 2.VC):

PROBLEM 1: I can't make the 2. VC transparent. I have read a lot of stackOverFlow solutions but nothing seems to work in my case. I have tried the following setup in IB both in my current project and in this simple project and something strange occurs (IB,for 2.VC):


  1. 将alpha值设置为低于0.5

  2. 将opaque设置为checked

  3. 将背景颜色设置为black

https:/ /imageshack.com/i/kqdXWk9Jp

单击转到下一个VC时推送第二个VC(推送或模态,无关紧要) )当他被推动时,我看到了我想要的结果:

The second VC gets pushed when I click "GO TO NEXT VC" (push or modally , doesn't matter) and while he is being pushed I see the the result I want:

https://imageshack.com/i/idXUCFCPp

...当推送完成后,新VC从透明变为黑色(不透明):

... and when the push is finished the new VC changes from being transparent to black (not transparent):

https:// imageshack。 com / i / iqmLw8D1p

我不知道为什么这个我发生了,我不能让它停止这样的工作。
Q1:为什么会发生这种情况?

I have no clue why this is happening and I cant get it to stop working like that. Q1: Why is this happening?

Q2:为什么我不能在用IB创建视图时以编程方式更改视图的属性?
我已经完成了这一千次而没有使用IB。一旦我开始使用IB,就不会像我们尝试以编程方式编辑内容时那样工作。
当我只在代码中执行所有这些步骤而没有IB时,一切都很好,但我需要在下一个项目中使用IB。我正在使用Xcode 5.1.1。在mac mini(2009年末)与小牛队。

Q2: Why can't I change the properties of the views programmatically when the views are created with IB? I have done this thousand times WITHOUT using IB. As soon as I start using IB things don't work like they are supposed especially when I try to edit stuff programmatically. When I do all of these steps without IB only in code everything works perfectly fine but I need to use the IB in my next project. I am using Xcode 5.1.1. on mac mini (late 2009) with Mavericks.

推荐答案

抱歉英语不好。

你的问题是因为iOS的内存管理删除了以前的界面ViewController,以节省资源。

Your problem is because the memory management of iOS removes the previous interface ViewController, to save resources.

之后在iOS7中,您可以自定义过渡视图控制器。请阅读: UIViewControllerAnimatedTransitioning Protocol Reference

After iOS7, you can customize the transition viewControllers. Please read: UIViewControllerAnimatedTransitioning Protocol Reference.

我也遇到了同样的问题,并按照教程自定义UIViewController转换

I also had the same problem and managed to solve it by following the tutorial Custom UIViewController Transitions.

如果您仍有疑问,还有另一个教程可以帮助您: iOS7:自定义转换

If you are still having doubts, there is another tutorial to help you: iOS7: Custom Transitions.

希望你获得成功!

这篇关于ios 7 - IB的透明度无法正常工作?以编程方式设置透明度也不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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