41 lines
1.4 KiB
Mathematica
41 lines
1.4 KiB
Mathematica
|
|
//
|
||
|
|
// C2CChatViewController.m
|
||
|
|
// TreeHole
|
||
|
|
//
|
||
|
|
// Created by 谢培艺 on 2022/5/7.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "C2CChatViewController.h"
|
||
|
|
#import "TZImagePickerController+MTImagePicker.h"
|
||
|
|
|
||
|
|
@interface C2CChatViewController ()
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation C2CChatViewController
|
||
|
|
|
||
|
|
- (void)viewDidLoad {
|
||
|
|
[super viewDidLoad];
|
||
|
|
// Do any additional setup after loading the view.
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)selectPhotoForSendV2 {
|
||
|
|
TZImagePickerController *imagePicker = [TZImagePickerController mt_imagePickerWithMaxImagesCount:9 didFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
|
||
|
|
for (UIImage *photo in photos) {
|
||
|
|
NSData *data = UIImageJPEGRepresentation(photo, 0.75);
|
||
|
|
NSString *path = [TUIKit_Image_Path stringByAppendingString:[TUITool genImageName:nil]];
|
||
|
|
[[NSFileManager defaultManager] createFileAtPath:path contents:data attributes:nil];
|
||
|
|
V2TIMMessage *message = [[V2TIMManager sharedInstance] createImageMessage:path];
|
||
|
|
[self sendMessage:message];
|
||
|
|
// if ([self.inputController.delegate respondsToSelector:@selector(inputController:didSendMessage:)]) {
|
||
|
|
// [self.inputController.delegate inputController:self.inputController didSendMessage:message];
|
||
|
|
// }
|
||
|
|
usleep(1);
|
||
|
|
}
|
||
|
|
}];
|
||
|
|
|
||
|
|
[self.navigationController presentViewController:imagePicker animated:YES completion:nil];
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|