zoukankan      html  css  js  c++  java
  • ios 判断相册文件图片大小的方法

    ALAssetsLibrary* alLibrary = [[ALAssetsLibrary alloc] init];

        

        [alLibrary assetForURL:[info objectForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset)

         {

             ALAssetRepresentation *representation = [asset defaultRepresentation];

             if ([representation size] > 1000*1000*2)

             {

                 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"图片超出了2M,请重新选择" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];

                 alert.tag = KIMAGE_EXCEED_TAG;

                 [alert show];

                 return;

             }

             else

             {

                 UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

                 UIImage *uploadImage = [FMUImage imageByScalingAndCroppingForSize:CGSizeMake(800, 600) SourceImage:image CropType:FMUIMAGE_SCALE_TYPE_FITMIN];

                 //发起上传网络请求

                 self.temper = [gNetworkManager uploadHousePic:uploadImage delegate:self]

                 

                [self dismissModalViewControllerAnimated:YES];

                 

             }

         }

                  failureBlock:^(NSError *error)

         {

     

         }];

  • 相关阅读:
    git命令小汇总和github
    有关版本控制--SVN
    ng-做一个简单的通讯录--学习使用路由和HTTP
    ng-辅助操作
    ng-router
    ng-http
    ng-指令
    ng-组件
    ng-核心特性(模型概念)
    ng--tolist说明
  • 原文地址:https://www.cnblogs.com/uwking/p/4218362.html
Copyright © 2011-2022 走看看