UIImageVIew
我用 placeholder.png 图像初始化。当我尝试使用UIImagePicker
控制器中的图像更改 placeholder.png 时,它不会改变。
employeePhoto=[[UIImageView alloc] init];
[employeePhoto setFrame:CGRectMake(50, 50, 150, 150)];
[employeePhoto setImage:[UIImage imageNamed:@"placeholder.png"]];
[self.view addSubview:employeePhoto];
在UIImagePickerController
委托中
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image=[info valueForKey:@"UIImagePickerControllerOriginalImage"];
[employeePhoto setImage:nil]; // or employeePhoto.image=nil;
[employeePhoto setImage:image];
[picker dismissViewControllerAnimated:YES completion:NULL];
}
但是在解雇选择器后UIImageView
不会改变。我也试过用UIButton
而不是UIImageView
. UIImageView
并UIButton
声明为@property(nonatomic, retain)
,我使用的是 xcode 4.6.1。
请帮我解决这个问题...
提前致谢.....