zoukankan      html  css  js  c++  java
  • 对图库的操作

    选择相册: 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];  
    }  
  • 相关阅读:
    multiview
    RadioButton
    信息存储与管理读书笔记1
    个人Wordpress站点设置Windows Live writer
    test
    test
    AS类库推荐
    JAVA坏境变量中的JAVA_HOME path classpath 的设置与作用
    actionscript3 中关于sprite的mask问题
    RED5遍历客户端并生成在线列表[转]
  • 原文地址:https://www.cnblogs.com/Ganggang888/p/5253539.html
Copyright © 2011-2022 走看看