日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

头像图片裁剪

發布時間:2025/3/21 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 头像图片裁剪 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

1.第三方?

TZImagePickerController.h

- (void)pushTZImagePickerController {// if (self.maxCountTF.text.integerValue <= 0) {// return;// }TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 columnNumber:3 delegate:self pushPhotoPickerVc:YES];// imagePickerVc.navigationBar.translucent = NO;#pragma mark - 五類個性化設置,這些參數都可以不傳,此時會走默認設置imagePickerVc.isSelectOriginalPhoto = YES;// if (self.maxCountTF.text.integerValue > 1) {// 1.設置目前已經選中的圖片數組// imagePickerVc.selectedAssets = YES; // 目前已經選中的圖片數組// }imagePickerVc.allowTakePicture = YES; // 在內部顯示拍照按鈕imagePickerVc.allowTakeVideo = YES; // 在內部顯示拍視頻按imagePickerVc.videoMaximumDuration = 10; // 視頻最大拍攝時間[imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) {imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;}];// imagePickerVc.photoWidth = 1000;// 2. Set the appearance// 2. 在這里設置imagePickerVc的外觀// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];// imagePickerVc.navigationBar.translucent = NO;imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];imagePickerVc.showPhotoCannotSelectLayer = YES;imagePickerVc.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];[imagePickerVc setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {[doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];}];/*[imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {cell.contentView.clipsToBounds = YES;cell.contentView.layer.cornerRadius = cell.contentView.tz_width * 0.5;}];*/// 3. Set allow picking video & photo & originalPhoto or not// 3. 設置是否可以選擇視頻/圖片/原圖imagePickerVc.allowPickingVideo = NO;imagePickerVc.allowPickingImage = YES;imagePickerVc.allowPickingOriginalPhoto = YES;imagePickerVc.allowPickingGif = NO;imagePickerVc.allowPickingMultipleVideo = NO; // 是否可以多選視頻// 4. 照片排列按修改時間升序imagePickerVc.sortAscendingByModificationDate = NO;// imagePickerVc.minImagesCount = 3;// imagePickerVc.alwaysEnableDoneBtn = YES;// imagePickerVc.minPhotoWidthSelectable = 3000;// imagePickerVc.minPhotoHeightSelectable = 2000;/// 5. Single selection mode, valid when maxImagesCount = 1/// 5. 單選模式,maxImagesCount為1時才生效imagePickerVc.showSelectBtn = NO;imagePickerVc.allowCrop = YES;// imagePickerVc.needCircleCrop = YES;// 設置豎屏下的裁剪尺寸NSInteger left = 30;NSInteger widthHeight = self.view.frame.size.width - 2 * left;NSInteger top = (self.view.frame.size.height - widthHeight) / 2;// imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight);imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight);//imagePickerVc.allowPreview = NO;// Deprecated, Use statusBarStyle// imagePickerVc.isStatusBarDefault = NO;imagePickerVc.statusBarStyle = UIStatusBarStyleLightContent;// 設置是否顯示圖片序號imagePickerVc.showSelectedIndex = YES;#pragma mark - 到這里為止// You can get the photos by block, the same as by delegate.// 你可以通過block或者代理,來得到用戶選擇的照片.[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {NSLog(@"");for (UIImage *img in photos) {self.image = img;}[self.tableView reloadData];}];[self presentViewController:imagePickerVc animated:YES completion:nil]; }

?

轉載于:https://www.cnblogs.com/dujiahong/p/9944663.html

總結

以上是生活随笔為你收集整理的头像图片裁剪的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。