在iOS 5中为基于页面的应用程序加载背景图像的正确方法? [英] Correct way to load a background image for a Page Based application in iOS 5?

查看:50
本文介绍了在iOS 5中为基于页面的应用程序加载背景图像的正确方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iOS 5开发iBooks类型的应用程序,除了背景图片,其他所有功能都可以正常工作.特别是在横向模式下.

I'm working on an iBooks type of app for iOS 5 and have everything working except for the background image. Specifically in landscape mode.

到目前为止,我一直在使用:

Up to this point I've been using:

UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"book.png"]];

[self.view addSubview:background];
[self.view sendSubviewToBack:background];

如果我在RootViewController上执行此操作,则脊柱显然不会在页面视图控制器的视图中显示,并且如果我在页面视图控制器类中使用此功能,它将删除使用CGRectInset来指定应该从何处开始pagecurl的功能

If I do this on the RootViewController, the spine obviously doesn't show through the page view controller's view and if I use this inside the page view controller class, it removes the ability to use CGRectInset to specify where the pagecurl should begin.

我敢肯定这可能是相当基本的东西,但是我浏览了我所拥有的每本书以及与Google一样的书,但我看不到任何地方都涵盖了这本书.任何帮助将不胜感激.

I'm sure this is probably something pretty basic, but I've looked through every book that I have as well as Google, and I don't see this covered anywhere. Any help would be appreciated.

谢谢

推荐答案

您将需要为书使用背景图像,然后在右侧使用右侧页面图像,在左侧使用左侧图像.这些将需要与整本书的背景图像对齐并匹配.您可以对所有这三个使用UIImageView.请记住,左页面图像和右页面图像需要完全正方形(除了书脊),没有透明区域,否则您会得到怪异的阴影效果.另外,还要确保所有背景色都设置为清除.

You will need to use a background image for your book and then use a right page image for the right side and a left side image for the left side. These will need to align and match up with the full book background image. You can use a UIImageView for all three. Keep in mind that the left and right page images will need to be perfectly square (except for the spine) with no transparent area, otherwise you get a weird shadowing effect. Also make sure all background colors are set to clear.

因此您将具有以下层次结构:

So you will have this hierarchy:

  • 根视图(全屏范围)
    • 书本背景视图(无论您想要多大)
      • 页面视图控制器(比书的背景视图小一点,您必须使用它,直到一切看起来正确为止)
        • 左页面视图控制器
          • 左侧页面的图像以及页面上其他所有内容
          • Root View (full screen bounds)
            • Book Background View (However big you want)
              • Page View Controller (A little smaller than the book background view, you'll have to play with this until everything looks right)
                • Left page view controller
                  • Image of left page and whatever else goes on the page
                  • 右侧页面的图像以及页面上其他所有内容

                  我希望这是有道理的.

                  这篇关于在iOS 5中为基于页面的应用程序加载背景图像的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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