imagePicker带选取白框和不带框

例:

UIImagePickerControllerSourceTypesourceType =UIImagePickerControllerSourceTypePhotoLibrary;

UIImagePickerController*imagepicker = [[UIImagePickerControlleralloc]init];

imagepicker.delegate=self;

//imagepicker.allowsEditing = YES;

imagepicker.sourceType= sourceType;

[selfpresentViewController:imagepickeranimated:YEScompletion:nil];

1、allowsEditing 和  - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info 决定了带白框选取

{

UIImage*originalImage = [infoobjectForKey:UIImagePickerControllerEditedImage];


如果不设置allowsEditing 和 使用 UIImagePickerControllerorignalImage则不带选取白框功能

显示圆形头像

NSArray*paths= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString*documentsDirectory= [paths objectAtIndex:0];NSString*imageFilePath= [documentsDirectory stringByAppendingPathComponent:@"selfPhoto.jpg"];NSLog(@"imageFile->>%@",imageFilePath);UIImage*selfPhoto= [UIImage imageWithContentsOfFile:imageFilePath];//self.img.image = selfPhoto;[self.img.layer setCornerRadius:CGRectGetHeight([self.img bounds]) /2];//修改半径,实现头像的圆形化self.img.layer.masksToBounds = YES;

这篇文章可以看看

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容