• 对图库的操作


    选择相册: UIImagePickerControllerSourceTypesourceType=UIImagePickerControllerSourceTypeCamera;  
       if (![UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {  
           sourceType=UIImagePickerControllerSourceTypePhotoLibrary;  
       }  
       UIImagePickerController * picker = [[UIImagePickerControlleralloc]init];  
       picker.delegate = self;  
       picker.allowsEditing=YES;  
       picker.sourceType=sourceType;  
       [self presentModalViewController:picker animated:YES];  
    选择完毕:  -(void)imagePickerController:(UIImagePickerController*)pickerdidFinishPickingMediaWithInfo:(NSDictionary *)info  
    {  
       [picker dismissModalViewControllerAnimated:YES];  
       UIImage * image=[info objectForKey:UIImagePickerControllerEditedImage];  
       [self performSelector:@selector(selectPic:) withObject:imageafterDelay:0.1];  
    }  
     -(void)selectPic:(UIImage*)image  
    {  
       NSLog(@"image%@",image);   
       imageView = [[UIImageView alloc] initWithImage:image];  
       imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height);  
    [self.viewaddSubview:imageView];  
       [self performSelectorInBackground:@selector(detect:) withObject:nil];  
    }  
    detect 为自己定义的方法,编辑选取照片后要实现的效果 取消选择:  -(void)imagePickerControllerDIdCancel:(UIImagePickerController*)picker  
     
    {  
       [picker dismissModalViewControllerAnimated:YES];  
    }  
  • 相关阅读:
    判断文件结束,feof……
    第五篇 分治思想(例子待加)
    第四篇 枚举思想
    第三篇 贪心思想
    第二篇 递归思想
    第一篇 递推思想
    爬虫系列
    整数划分问题
    html中a标签做容器的问题
    H5学习小结——div+css创建电子商务静态网页
  • 原文地址:https://www.cnblogs.com/Ganggang888/p/5253539.html
Copyright © 2020-2023  润新知