我得到了这个代码,可以调出本地“分享” 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/