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)

         {

     

         }];

  • 相关阅读:
    css计数器
    使用area标签模仿a标签
    移动端判断触摸的方向
    简单圆形碰撞检测
    冒泡排序和二分查找算法
    基本数据类型float和double的区别
    HTML5-form表单
    代码块以及它们的执行顺序
    反射
    Excel表格的导入导出
  • 原文地址:https://www.cnblogs.com/uwking/p/4218362.html
Copyright © 2011-2022 走看看