Permalink
Browse files

Merge pull request #1 from smokyonion/master

Added another alternate way using block to run the save panel modal
  • Loading branch information...
2 parents c56e376 + 73159a5 commit bf3c9dd2eb6dca1775871afc338d633562c41ffc @jaz303 committed Jul 13, 2012
Showing with 13 additions and 0 deletions.
  1. +1 −0 JFImageSavePanel/JFImageSavePanel.h
  2. +12 −0 JFImageSavePanel/JFImageSavePanel.m
@@ -10,5 +10,6 @@
+ (JFImageSavePanel *)savePanel;
- (NSInteger)runModalForImage:(NSImage *)image error:(NSError **)error;
+- (void)beginWithImage:(NSImage *)image completionHandler:(void (^)(NSInteger result))block;
@end
@@ -67,6 +67,18 @@ - (NSInteger)runModalForImage:(NSImage *)image error:(NSError **)error
return result;
}
+- (void)beginWithImage:(NSImage *)image completionHandler:(void (^)(NSInteger result))block
+{
+ [self configureSavePanel];
+ [self.savePanel beginWithCompletionHandler:^(NSInteger result) {
+ if (result == NSFileHandlingPanelOKButton) {
+ [self saveImage:image];
+ }
+
+ block(result);
+ }];
+}
+
- (void)configureSavePanel
{
[self.savePanel setAccessoryView:self.accessoryView];

0 comments on commit bf3c9dd

Please sign in to comment.