Ios 处理这个问题。谢谢此解决方案在横向模式下有效,但在纵向模式下,它会一直倒回列表。它适用于我的情况。我认为结论可能是,这取决于你的故事板是如何设置的,以及你使用的是什么类型的模式。这是有效的。然而,在我的例子中,我必须另外打开sourceViewContro
Ios 处理这个问题。谢谢此解决方案在横向模式下有效,但在纵向模式下,它会一直倒回列表。它适用于我的情况。我认为结论可能是,这取决于你的故事板是如何设置的,以及你使用的是什么类型的模式。这是有效的。然而,在我的例子中,我必须另外打开sourceViewContro,ios,objective-c,ios8,unwind-segue,adaptive-ui,Ios,Objective C,Ios8,Unwind Segue,Adaptive Ui,处理这个问题。谢谢此解决方案在横向模式下有效,但在纵向模式下,它会一直倒回列表。它适用于我的情况。我认为结论可能是,这取决于你的故事板是如何设置的,以及你使用的是什么类型的模式。这是有效的。然而,在我的例子中,我必须另外打开sourceViewController(AnyObject),并检查它是否实际上是一个UIViewcontroller。此解决方法在iOS 9 beta版中停止工作。苹果显然解决了最初的问题,但这项检查没有发现它被解雇了,导致了两次解雇。 - (void)prepareFo
处理这个问题。谢谢此解决方案在横向模式下有效,但在纵向模式下,它会一直倒回列表。它适用于我的情况。我认为结论可能是,这取决于你的故事板是如何设置的,以及你使用的是什么类型的模式。这是有效的。然而,在我的例子中,我必须另外打开sourceViewController(
AnyObject
),并检查它是否实际上是一个UIViewcontroller
。此解决方法在iOS 9 beta版中停止工作。苹果显然解决了最初的问题,但这项检查没有发现它被解雇了,导致了两次解雇。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)__unused sender
{
if ([[segue identifier] isEqualToString:@"showSelectBookChapter"])
{
UINavigationController *navigationController = segue.destinationViewController;
if ([navigationController.topViewController isKindOfClass:[BIBLESelectViewController class]])
{
BIBLESelectViewController *selectViewController = (BIBLESelectViewController *)navigationController.topViewController;
selectViewController.initialBookChapterVerse = self.bookChapterVerse;
}
}
}
- (IBAction)unwindToBIBLEChapterViewController:(UIStoryboardSegue *)segue
{
if ([segue.identifier isEqualToString:@"unwindToBIBLEChapterViewController"]) {
if ([segue.sourceViewController isKindOfClass:[BIBLESelectViewController class]])
{
BIBLESelectViewController *sourceViewController = (BIBLESelectViewController *)segue.sourceViewController;
self.bookChapterVerse = sourceViewController.selectedBookChapterVerse;
[self.tableView reloadData];
}
}
}
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:[UIDevice currentDevice]];
- (void) orientationChanged:(NSNotification *)note{
UIDevice * device = note.object;
//CGRect rect = [[self view] frame];
switch(device.orientation)
{
default:
[self dismissViewControllerAnimated:YES completion:nil];
break; }}
if !segue.sourceViewController.isBeingDismissed() {
segue.sourceViewController.dismissViewControllerAnimated(true, completion: nil)
}
@implementation MyNavigationController
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController
fromViewController:(UIViewController *)fromViewController
identifier:(NSString *)identifier
{
if (toViewController == self.topViewController && fromViewController.presentingViewController == self)
return [toViewController segueForUnwindingToViewController:toViewController
fromViewController:fromViewController
identifier:identifier];
else
return [super segueForUnwindingToViewController:toViewController
fromViewController:fromViewController
identifier:identifier];
}
@end
@IBAction func yourUnwindSegue(segue: UIStoryboardSegue) {
if #available(iOS 9, *) {
return // bug fixed in iOS 9, just return and let it work correctly
}
// do the fix for iOS 8 bug
// access your SplitViewController somehow, this is one example
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let splitVC = appDelegate.window!.rootViewController as! YourSplitViewController
// if the source isn't being dismissed and the splitView isn't
// collapsed (ie both windows are showing), do the hack to
// force it to dismiss
if !segue.sourceViewController.isBeingDismissed() && splitVC.collapsed == false {
segue.sourceViewController.dismissViewControllerAnimated(true, completion: nil)
}
}