【问题标题】:UIView gets added flippedUIView 被添加翻转
【发布时间】:2014-08-30 14:17:08
【问题描述】:

我创建了一个空的 *.xib,添加了类并引用了它们。

我需要显示对当前显示的所有 UIView 的控制。我这样做是为了显示控件:

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
ExternalDisplayRemoteControl *remoteControl = [[ExternalDisplayRemoteControl alloc]initWithNibName:@"ExternalDisplayRemoteControl" bundle:nil];
remoteControl.view.frame = CGRectMake(20, 20, appDelegate.window.bounds.size.width-40, appDelegate.window.bounds.size.height-40);
remoteControl.view.alpha = 0.0;

[appDelegate.window addSubview:remoteControl.view];



//Display the customView with animation

[UIView animateWithDuration:0.4 animations:^{
   [remoteControl.view setAlpha:1.0];
} completion:^(BOOL finished) {}];

在 Interface Builder 中,我尝试将方向设置为横向 - 没有帮助

结果是:

我添加的 UIView 顺时针旋转了 90 度...为什么?

截图:

【问题讨论】:

    标签: ios objective-c ipad uiview


    【解决方案1】:

    找到答案:

    此解决方案:不考虑设备旋转。

    更好的解决方案:

    UIWindow* window = [UIApplication sharedApplication].keyWindow;
    if (!window)
        window = [[UIApplication sharedApplication].windows objectAtIndex:0];
    [[[window subviews] objectAtIndex:0] addSubview:remoteControl.view];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-09
      • 2014-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多