TTWebController 自动旋转到横向

发布于 2024-10-31 11:16:32 字数 1185 浏览 5 评论 0原文

我似乎无法让我的 TTWebController 自动旋转。我的 UITabBar 子类对除 TTWebController 子类之外的所有视图上的 shouldAutorotateToInterfaceOrientation 做出响应。该类会自行响应,但即使我返回“是”,也不会轮换。

这就是我的 TTWebController 子类的样子:

http://snipt.org/wpnM

这是我在 UITabBar 子类中测试的内容:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSLog(@"shouldAutorotateToInterfaceOrientation: %@", [[TTNavigator navigator] visibleViewController]);
if ([[[TTNavigator navigator] visibleViewController] isKindOfClass:[TTWebController class]]) {
    return YES;
}

// if you're in the "more..." tab and the topViewController is a TTWebController
// Note: this is required because of a Three20 bug where [[TTNavigator navigator] visibleViewController]
// doesn't work properly if you're in the "more..." tab
if ([self.moreNavigationController.topViewController isKindOfClass:[TTWebController class]]) {
    return YES;
}

// Still here? Return YES only if portrait
return (interfaceOrientation == UIDeviceOrientationPortrait);
}

// Stefan

I can't seem to get my TTWebController to autorotate. My UITabBar subclass responds to shouldAutorotateToInterfaceOrientation on all my views except for my TTWebController subclass. That class responds itself but doesn't rotate even though I return YES.

This is what my TTWebController subclass looks like:

http://snipt.org/wpnM

This is what I've been testing in my UITabBar subclass:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSLog(@"shouldAutorotateToInterfaceOrientation: %@", [[TTNavigator navigator] visibleViewController]);
if ([[[TTNavigator navigator] visibleViewController] isKindOfClass:[TTWebController class]]) {
    return YES;
}

// if you're in the "more..." tab and the topViewController is a TTWebController
// Note: this is required because of a Three20 bug where [[TTNavigator navigator] visibleViewController]
// doesn't work properly if you're in the "more..." tab
if ([self.moreNavigationController.topViewController isKindOfClass:[TTWebController class]]) {
    return YES;
}

// Still here? Return YES only if portrait
return (interfaceOrientation == UIDeviceOrientationPortrait);
}

// Stefan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文