在EAGLview或View中使用presentViewController

时间:2014-06-03 07:12:40

标签: ios uiview uiviewcontroller uiactivityviewcontroller

我有EAGLView,我正在从 glReadPixels 获取eaglview的屏幕截图。它正在工作并保存到相册,我需要与社交分享。所以,我使用了UIActivityViewController。当我在EAGLView内使用它时,我没有presentViewController的可见界面。

 UIImage *glImage = [self glToUIImage];
        UIImage *screensht = [self createSavableImage:glImage];

        NSArray *activityItems = @[screensht];

        UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
        avc.excludedActivityTypes = [NSArray arrayWithObjects:UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, nil];
        [self presentViewController:avc animated:YES completion:nil];

1 个答案:

答案 0 :(得分:0)

presentViewController:animated:completion:是UIViewController类的方法,而不是UIView或其子类。代码最后一行中的self指向您的EAGLView实例。