我正在我的应用程序中实现 Peek 和 Pop 以及 UIPreviewActions。我已经设置好 PreviewView,Peek 和 Pop 都很好用,我的问题是向其中添加 UIPreviewActions。当然,您必须将 UIPreviewAction 方法放在预览控制器中,那么如何让它关闭该视图,并在其父控制器中打开该视图?
我在 PreviewController 中有:
- (NSArray*)previewActionItems {
// setup a list of preview actions
UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"Post to Facebook" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"Message" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action3 = [UIPreviewAction actionWithTitle:@"Email" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
[self displayComposerSheet];
}];
// add them to an arrary
NSArray *actions = @[action1, action2, action3];
// and return them
return actions;
}
displayComposerSheet 只是一种编写电子邮件的标准方法,其中包括用于显示它的 self presentViewController 方法。但是,所有这些方法都在 PreviewController 中,但从技术上讲,Mail 编写器需要从所有这些所在的 TableView 中启动。我该怎么做呢?