ios - 当 View Controller 以编程方式呈现时,如何知道它何时展开

标签 ios uiviewcontroller uiactivityindicatorview

我得到了这个代码,可以调出本地“分享” View ,用户可以在其中发布到 facebook/twitter 等...有一个完成 block ,但这只有在 VC 显示自己时才会调用,我需要知道它什么时候解散。因为我的应用程序有不同的横向/纵向模态视图 Controller ,如果用户旋转并且 UIACtivityViewController 在屏幕上,我不想关闭 View 。

我会在按下共享按钮时发送通知,以便在用户旋转设备时不会关闭当前 View 。我现在只需要知道它什么时候被关闭,这样我就可以重新启用该功能

- (IBAction)shareButtonPressed:(UIButton *)sender {
    // Notify that another view is on screen to allow rotation without view disapearing.
    [self sendNotificationWithName:@"landscapeViewHasPopupActive" andObject:@"empty string"];

    NSString *message = @"Hello World!";
    UIImage *imageToShare = [UIImage imageNamed:@"Icon.png"];

    NSArray *postItems = @[message, imageToShare];

    UIActivityViewController *activityVC = [[UIActivityViewController alloc]
                                            initWithActivityItems:postItems
                                            applicationActivities:nil];

    [self presentViewController:activityVC animated:YES completion:^() {

    }];
    // Is showing landscape set to NO, and YES when this view disapears
}

最佳答案

在 ios6 Storyboard中,有一个叫做 unwind segue 的东西。向呈现 Controller 添加一个方法以验证展开是否可以/将会发生。用谷歌检查。

关于ios - 当 View Controller 以编程方式呈现时,如何知道它何时展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18725279/

相关文章:

objective-c - ios - UIActivityIndi​​catorView 是否应该默认显示?

iphone - 滚动时 UITableView 应用程序崩溃

ios - 如何检查 View Controller 是否是初始 View Controller ? ( swift 3)

ios - 在自定义 Sirikit 中访问用户当前位置打算,iOS,swift

iPhone UIViewController 内的 UINavigationController

ios - 在 Objective-C 中,如何在 View Controller 中的函数之间共享数据?

objective-c - UIButton里面的UIActivityIndi​​catorView

ios - 我可以更改 UIActivityIndi​​cator 的大小吗?

ios - 如何隐藏/取消隐藏 Collection View 中的部分

objective-c - 如何让 Date 每 n 秒跳转一次?