我正在尝试将图像从一个传递UIViewController
到另一个UIViewController
。但我没有成功。我的代码如下。
PostGameViewController *v1=[[PostGameViewController alloc]initWithNibName:@ "PostGameViewController" bundle:nil];
v1.theImg = imgPicture;
[self.navigationController pushViewController:v1 animated:YES];
// 在“.h”中
@interface PostGameViewController : UIViewController{
UIImage *img;
UIImageView *theImg;
}
@property(nonatomic,retain)IBOutlet UIImageView *theImg;
@property(nonatomic,retain)UIImage *img;
-(IBAction)clickFacebook:(id)sender;
//在“.m”中
- (void)viewDidLoad
{
[super viewDidLoad];
[theImg setImage:img];
}