我得到了这段代码,它显示了用户可以在其中发布到 facebook/twitter 等的本机“共享”视图......有一个完成块,但这只有在 VC 显示自己时才会被调用,我需要知道什么时候它驳回了。UIACtivityViewController
因为我的应用在横向/纵向模式下有不同的视图控制器,如果用户旋转并且在屏幕上,我不想关闭视图。
如果用户旋转设备,我会在按下共享按钮时发送通知以不关闭当前视图。我现在只需要知道它什么时候被解雇,这样我就可以重新启用该功能
- (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
}