0
我用这个代码从Facebook的个人资料得到的图像,并显示在UIImageView的检索图像iphone库
// Get the profile image
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[result objectForKey:@"pic"]]]];
// Resize, crop the image to make sure it is square and renders
// well on Retina display
float ratio;
float delta;
float px = 100; // Double the pixels of the UIImageView (to render on Retina)
CGPoint offset;
CGSize size = image.size;
if (size.width > size.height) {
ratio = px/size.width;
delta = (ratio*size.width - ratio*size.height);
offset = CGPointMake(delta/2, 0);
} else {
ratio = px/size.height;
delta = (ratio*size.height - ratio*size.width);
offset = CGPointMake(0, delta/2);
}
CGRect clipRect = CGRectMake(-offset.x, -offset.y,
(ratio * size.width) + delta,
(ratio * size.height) + delta);
UIGraphicsBeginImageContext(CGSizeMake(px, px));
UIRectClip(clipRect);
[image drawInRect:clipRect];
UIImage *imgThumb = UIGraphicsGetImageFromCurrentImageContext();
[imgThumb retain];
imageFb=imgThumb;
[profilePhotoImageView setImage:imgThumb];
我想打一个按钮,点击后可以让用户通过图像来改变形象iPhone的图书馆(他用iPhone拍摄的照片)。我不知道如何继续,请帮助
有关更多控制,请参阅资产库框架。它在很多方面都是“更现代的”,并提供了使用“UIImagePickerController”无法获得的东西,但它不提供“UIViewController”级别的API,因此需要实施更多的工作。 – smparkes
我是初学者我只会使用UIImagePickerController xd – user567