【问题标题】:TTLauncherView in iPad landscape mode has a blank white area on the rightiPad横向模式下的TLauncher View右侧有一个空白区域
【发布时间】:2011-03-02 01:50:48
【问题描述】:

我还没有花足够的时间查看 TTLauncherView 背后的代码,但是在横向模式下,它的右侧似乎有一个空白区域。我正在考虑重写启动器,但有人有更优雅的解决方案吗?我想删除空白区域,而是将项目重新组织到该空白区域。

【问题讨论】:

  • 你可以继承 TTLaucherView 并添加横向支持。我可以确认这不是那么快。

标签: iphone objective-c ipad uiviewcontroller three20


【解决方案1】:

我认为您可以比这更容易做到这一点......我对这个工具包很陌生,但这似乎在我的应用程序中工作:

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self.view setBackgroundColor:[UIColor clearColor]];

}

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [_launcherView setFrame:self.view.bounds];
}

编辑: 抱歉编辑,我只是​​不断寻找更好的方法来做到这一点。我们可以覆盖一个动画方法,该方法自动为我们的 TTLauncherItems 的旋转设置动画。我更改了视图的 alpha 以隐藏图标旋转的突然性:

-(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    [_launcherView setFrame:self.view.bounds];
    //[self.view setAlpha:0.4];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.1];
    [self.view setAlpha:1];
    [UIView commitAnimations];
}
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    [self.view setBackgroundColor:[UIColor clearColor]];
    [self.view setAlpha:1];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.1];
    [self.view setAlpha:0.7];
    [UIView commitAnimations];

}

【讨论】:

    【解决方案2】:

    这可以更容易地完成。我喜欢这个没有 willRotate 方法的解决方案:

    -(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
      [UIView beginAnimations:nil context:NULL];
      [_launcherView setFrame:self.view.bounds];
      [UIView commitAnimations];
    }
    

    它对我有用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-18
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多