gpt4 book ai didi

iphone - ViewController 没有响应 didRotateFromInterfaceOrientation

转载 作者:搜寻专家 更新时间:2023-10-30 20:04:25 25 4
gpt4 key购买 nike

我的 View Controller 没有响应 didRotateFromInterfaceOrientation,尽管我在我的代码中添加了以下内容:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[self.popOver dismissPopoverAnimated:NO];
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
... My Custom Code...
}
}

我是不是做错了什么?

最佳答案

如果你不能从 UIViewController 继承(不幸的是),你可以使用 this :

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

然后注册开始接收UIDeviceOrientationDidChangeNotification通知。

关于iphone - ViewController 没有响应 didRotateFromInterfaceOrientation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3860714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com