AFPhotoEditorCustomization

AFPhotoEditorCustomization

我试图强迫用户将照片裁剪到Aviary的正方形。如Aviary documentation here中所述,可以禁用自定义裁剪并手动指定预设。我正在尝试以下操作:

[AFPhotoEditorCustomization setCropToolOriginalEnabled:NO];
[AFPhotoEditorCustomization setCropToolCustomEnabled:NO];
NSDictionary *SIZE = [[NSDictionary alloc] initWithObjectsAndKeys:
                      @"kAFCropPresetName",@"square",
                      @"kAFCropPresetWidth",@"1.0f",
                      @"kAFCropPresetHeight",@"1.0f",
                      nil];
[AFPhotoEditorCustomization setCropToolPresets:[[NSArray alloc] initWithObjects:SIZE, nil]];


但这是行不通的。结果是0裁剪选项:

最佳答案

您应该使用以下代码:

[AFPhotoEditorCustomization setCropToolOriginalEnabled:NO]; [AFPhotoEditorCustomization setCropToolCustomEnabled:NO]; NSDictionary * square = @{kAFCropPresetName: @"Square", kAFCropPresetHeight : @(1.0f), kAFCropPresetWidth : @(1.0f)}; [AFPhotoEditorCustomization setCropToolPresets:@[square]];

08-19 11:53