Trình phát trình cắm của YouTube chính là bộ điều khiển chế độ xem phương thức. Nó quay trở lại presentingViewController
khi nhấn nút xong. presentingViewController
của nó không phải là bộ điều khiển xem phương thức nhưng thay vào đó là viewController được gọi là [presentModalViewController:animated:]
để trình bày bộ điều khiển chế độ xem phương thức của bạn. Vì bộ điều khiển chế độ xem ban đầu vẫn hoạt động, ứng dụng hoạt động kém.
Để khắc phục vấn đề này,
1) Theo dõi việc điều khiển xem phương thức đã được trình bày nhưng không bị sa thải.
2) Trong phương thức viewDidAppear
của bộ điều khiển xem trình bày, nếu trình điều khiển chế độ xem được trình bày và không được loại bỏ, loại bỏ và trình bày lại.
Ví dụ, trong bộ điều khiển được trình bày điều khiển xem web modal:
- (void) presentModalWebViewController:(BOOL) animated {
// Create webViewController here.
[self presentModalViewController:webViewController animated:animated];
self.modalWebViewPresented = YES;
}
- (void) dismissModalWebViewController:(BOOL) animated {
self.modalWebViewPresented = NO;
[self dismissModalViewControllerAnimated:animated];
}
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (self.modalWebViewPresented) {
// Note: iOS thinks the previous modal view controller is displayed.
// It must be dismissed first before a new one can be displayed.
// No animation is needed as the YouTube plugin already provides some.
[self dismissModalWebViewController:NO];
[self presentModalWebViewController:NO];
}
}
Đã tìm thấy giải pháp cho vấn đề của bạn, bạn có thể chia sẻ giải pháp với chúng tôi không? – Illep
chưa ... Tôi chưa tìm thấy nó – jonypz