【问题标题】:Multiple splash screen issue on iPhone5iPhone 5 出现多个闪屏问题
【发布时间】:2012-10-19 13:28:12
【问题描述】:

我有一个名为 Splashes 的简单类,它可以在启动时为三个图像设置动画。
它运行良好,但现在在 iPhone 5 上我无法自动调整视图大小。

这里是代码sn-ps:

- (void)viewDidLoad
  [...]
  if ( IS_IPHONE_5 ) _ImageSplash.image = [UIImage imageNamed:@"splash_1-568h@2x.png"];
  else _ImageSplash.image = [UIImage imageNamed:@"splash_1.png"];
  if ( IS_IPAD ) _ImageSplash.image = [UIImage imageNamed:@"splash_1_ipad.png"];

  [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(repeat) userInfo:nil repeats:YES];
  [...]
}

重复功能

[...]
int i=0;
[...]
- (void)repeat
{
  switch (i) {
    case 0:
      if ( IS_IPHONE_5 ) _ImageSplash.image = [UIImage imageNamed:@"splash_2-568h@2x.png"];
      else _ImageSplash.image = [UIImage imageNamed:@"splash_2.png"];
      if ( IS_IPAD ) _ImageSplash.image = [UIImage imageNamed:@"splash_2_ipad.png"];
      break;
    case 1:
      if ( IS_IPHONE_5 ) _ImageSplash.image = [UIImage imageNamed:@"splash_3-568h@2x.png"];
      else _ImageSplash.image = [UIImage imageNamed:@"splash_3.png"];
      if ( IS_IPAD ) _ImageSplash.image = [UIImage imageNamed:@"splash_3_ipad.png"];
      break;
    default: [self dismissModalViewControllerAnimated:NO]; break;
  }
  i++;
}

图像已根据设备正确加载,但 xib 保持不变。
不想自动调整大小。

这些是我的 XIB 的设置:

可能是什么问题?

所有其他 XIB 都运行良好,我只有这个问题。
iOS 仅在视图底部显示一条黑色条纹!很奇怪……

注意:我不能使用 AUTOLAYOUTS,因为它兼容 3.2+ 应用程序。


编辑:添加截图。

谢谢。

【问题讨论】:

  • 你能分享屏幕,即设备上到底发生了什么吗?如果可能的话?
  • 您是否检查过在 XIB 中为顶级视图选中了“自动调整子视图”?
  • 您确定您的IS_IPHONE_5 宏工作正常并且您不只是加载非iphone 5 图像吗?是否设置断点检查正在执行的代码?
  • 是的,图片加载正确,因为不同。 ip5 镜像带有红色喷雾...

标签: iphone objective-c ios splash-screen iphone-5


【解决方案1】:

我认为 CSmith 的回复应该有效,但无论如何,这可能会奏效:

CGRect windowFrame=[[[UIApplication sharedApplication].windows objectAtIndex:0] bounds];
[_ImageSplash setFrame:windowFrame];

把它放在 iPhone5 检查下,即当设备是 iPhone5 时。

【讨论】:

  • imageView 的 contentMode 是什么?应该是 scaleToFill
  • 现在,它吓坏了......你真的尝试了 CSmith 的建议,没有冒犯,只是确定一下?此外,如果您刚刚在项目中添加了工件,那么您需要清理编译项目,并且可能需要在运行之前删除早期的构建。
  • imageView 的自动调整大小窗口应该和您的视图一样。
  • 我在 initWithNibName 时设置了正确的框架(ip5 或更低)。好像没问题。
【解决方案2】:

除了当前设置(即固定到左侧、顶部、底部和允许灵活高度)之外,将图像视图上的自动调整大小遮罩更改为固定到顶部和底部。

【讨论】:

    猜你喜欢
    • 2014-07-25
    • 2012-02-29
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    • 2014-12-24
    • 1970-01-01
    相关资源
    最近更新 更多