我有一个带有 pdf 的 UIviewController。我使用另一个屏幕中的方向来显示 pdf。方向运行良好 3 次,然后应用程序挂起并显示以下警告。
[切换到进程11779线程0x0]
[切换到进程13059线程0x0]
[切换到进程11779线程0x0]
它说什么?请在下面找到代码。
- (void)viewDidLoad
{
self.view.backgroundColor = [UIColor clearColor];
pdfURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Sample" ofType:@"pdf"]];
[webView loadRequest:[NSURLRequest requestWithURL:pdfURL]];
thisDevice = [UIDevice currentDevice];
[thisDevice beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:UIDeviceOrientationDidChangeNotification object:nil];
[self setTitle:@"1 Of 1"];
[super viewDidLoad];
}
-(void) detectOrientation
{
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
//load view 2
IdcardVC *ids = [[IdcardVC alloc] initWithNibName:@"IdcardVC" bundle:nil];
[self.navigationController presentModalViewController:ids animated:YES];
[ids release];
}
else if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) {
[self dismissModalViewControllerAnimated:NO];
}
任何帮助表示赞赏。谢谢你