zoukankan      html  css  js  c++  java
  • 从相册选取图片展示并实现自定义事件

    UIImagePickerControllerSourceTypesourceType=UIImagePicker

    ControllerSourceTypeCamera;

    if(![UIImagePickerControllerisSourceTypeAvailable:UIImagePick

    erControllerSourceTypeCamera]) {

    sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

    }

    UIImagePickerController * picker =

    [[UIImagePickerControlleralloc]init];

    picker.delegate =self;

    picker.allowsEditing=YES;

    picker.sourceType=sourceType;

    [selfpresentModalViewController:picker

    animated:YES];

    -(void)imagePickerController:

    (UIImagePickerController*)pickerdidFinishPickingMediaWith

    Info:(NSDictionary *)info

    {

    [picker dismissModalViewControllerAnimated:YES];

    UIImage * image=[info

    objectForKey:UIImagePickerControllerEditedImage];

    [selfperformSelector:@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];

    [selfperformSelectorInBackground:@selector(detect:)

    withObject:nil];

    }

    detect为你自己的自定义方法

  • 相关阅读:
    图片处理连环画特效
    卡片翻页算法
    android 自定义属性
    android 中捕获全局异常
    c++ 学习笔记
    图片怀旧特效处理
    Linux 网络配置
    指针参数传递
    python 读写文件
    PopupWindow 点击外面取消
  • 原文地址:https://www.cnblogs.com/CJH5209/p/6072143.html
Copyright © 2011-2022 走看看