简体   繁体   English

自动旋转UIImageView子视图

[英]Auto rotation of UIImageView subviews

Root view is a UIImage View, it has subviews, those have subviews. 根视图是一个UIImage视图,它具有子视图,那些具有子视图。 My root view will open in landscape i have set both project properties in the project's .plist and have integrated application.statusBarOreintation in applicationDidFinishLaunching and verified that it works. 我的根视图将在横向中打开,我已经在项目的.plist中设置了两个项目属性,并在applicationDidFinishLaunching中集成了application.statusBarOreintation并验证了它的有效性。

But all of my subviews are appearing in portrait. 但是我所有的子视图都以纵向显示。 How do I change this on my subviews? 如何在子视图中更改此设置?

Thanks // :) 谢谢 // :)

Do you have a viewcontroller? 你有一个viewcontroller吗? What is your shouldAutorotateToInterfaceOrientation returning? 您应该将AutorotateToInterfaceOrientation返回什么?

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || 
            (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}

Without a viewcontroller, you will have to apply a transform to rotate each view you load. 如果没有ViewController,则必须应用变换来旋转加载的每个视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM