【问题标题】:Xcode 4.2 Portrait and Landscape and AlignmentXcode 4.2 纵向和横向以及对齐
【发布时间】:2017-08-02 20:00:06
【问题描述】:

Xcode 4.2

我正在使用 UIWebView 并排显示两张图片。在肖像中,它们与两张图片右侧的大空间对齐,而不是居中对齐,看起来很奇怪。

有没有办法让它们对齐中心?

也相关,

如何在 Xcode 4.2 的 Nib 文件中将显示转为横向?

【问题讨论】:

    标签: iphone xcode


    【解决方案1】:

    您可以在 Attribute Insperctor 中指定横向的方向以将显示变为横向。您可以在尺寸检查器中使用自动调整大小以将图像居中对齐。

    【讨论】:

    • 我找到了他们。感谢您的指导。有没有办法在用户进入屏幕时强制横屏,而无需用户转动手机来启动横屏?
    • 是的。您可以为此使用 -(BOOL)shouldAutorotateInterfaceOrientation :(UIInterfaceOrientation)interfaceOrientation 方法
    【解决方案2】:

    要打开横向显示,请使用此方法。这会将您的方向设置为横向模式。

     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscape);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-29
      • 2015-09-09
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 2011-01-12
      相关资源
      最近更新 更多