ios - QLPreviewController 编辑模式不起作用?

标签 ios objective-c crop qlpreviewcontroller

您可以使用 QLPreviewController 编辑图像吗?

例如,预览图像并裁剪它?如果没有,QLPreviewController 上的编辑属性有什么用?它似乎没有改变任何东西。 (预览文件工作正常)

这是一个例子:

QLPreviewController *previewController=[[QLPreviewController alloc]init];
previewController.delegate=self;
previewController.dataSource=self;
[previewController setCurrentPreviewItemIndex:selectedIndex];
[previewController setEditing:YES animated:YES];

[self presentModalViewController:previewController animated:YES];

委托(delegate)方法:

- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
    file = [folder.files objectAtIndex:index];

    controller.title = file.name;

    CustomQLPreviewItem *customQLPreviewItem = [[CustomQLPreviewItem alloc] init];

    customQLPreviewItem.previewItemURL = [NSURL fileURLWithPath:file.uri];
    customQLPreviewItem.previewItemTitle = file.name;

    return customQLPreviewItem;
}

- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller
{
    return folder.file.count;
}

最佳答案

QLPreviewController 不支持按照您的想法进行编辑。

编辑属性实际上继承自 UIViewController 和这里:

UIViewController Class Reference

editing A Boolean value indicating whether the view controller currently allows the user to edit the view contents.

@property(nonatomic, getter=isEditing) BOOL editing Discussion If YES, the view controller currently allows editing; otherwise, NO.

If the view is editable and the associated navigation controller contains an edit-done button, then a Done button is displayed; otherwise, an Edit button is displayed. Clicking either button toggles the state of this property. Add an edit-done button by setting the custom left or right view of the navigation item to the value returned by the editButtonItem method. Set the editing property to the initial state of your view. Use the setEditing:animated: method as an action method to animate the transition of this state if the view is already displayed.

Availability Available in iOS 2.0 and later. See Also – setEditing:animated: – editButtonItem Related Sample Code BonjourWeb iPhoneCoreDataRecipes Declared In UIViewController.h

关于ios - QLPreviewController 编辑模式不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20427030/

相关文章:

objective-c - ld : duplicate symbol - caused by const

ios - SDK不包含bitcode ios

iphone - 如何更改 UIImagePickerController 裁剪框

objective-c - 如何删除在我的 UIViewController 上某个特定点绘制的 UIImageView?

python - 用于调整图像大小的独立 Python 脚本

MATLAB 自动裁剪

ios - 混合 Box2D 加速度计 + 重力?

ios - OpenTok iOS API :Stream in iPad more then two

ios - 在 Xcode 4 中同步两个目标

ios - 在 UIImageView 的右上角添加 UIButton