最近在用 oc 到 swift 的迁移,对 swift 实在生疏,oc 中的 TZImagePickController 中有这么一个属性
@property (nonatomic, copy) void (^didFinishPickingPhotosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);
先前的调用方式是这样的
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { _fileArr = photos; NSString *webImg =[NSString stringWithFormat:@"[""]; for (int i=0; i<photos.count; i++) { // [self htmlForJPGImage:photos[i]] webImg =[webImg stringByAppendingString:[self htmlForJPGImage:photos[i]]]; webImg = [webImg stringByAppendingString:@"""]; if (i != photos.count - 1) { webImg = [webImg stringByAppendingString:@",""]; } else { webImg = [webImg stringByAppendingString:@"]"]; } } NSLog(@"%@",webImg); [self evaluateJsCode:callback val:webImg webview:self.webview]; }];
想问下改写成 swift3 应该怎么写?
1
mufeng 2018-01-09 15:49:12 +08:00
imagePickerVc?.didFinishPickingPhotosHandle = { (photos, assets, isSelectOriginalPhoto) -> Void in
/// ba la ba la } |