如何使UIImageView正确的帧大小?

tee*_*ton -1 objective-c frame uiviewcontroller uiimageview ios

我正在尝试使用imagePickerController拍照并在另一个ViewController中的UIImageView中显示图像.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissViewControllerAnimated:YES completion:NULL];
    PAWWallPostCreateViewController *wallPostCreateViewController = [[PAWWallPostCreateViewController alloc] initWithNibName:@"PAWWallPostCreateViewController" bundle:nil];

    wallPostCreateViewController.myImage = info[UIImagePickerControllerEditedImage];
    wallPostCreateViewController.imageView = [[UIImageView alloc] initWithImage:wallPostCreateViewController.myImage];
    wallPostCreateViewController.imageView.contentMode = UIViewContentModeScaleAspectFit;

    NSLog(@"%@",wallPostCreateViewController.imageView); // Output below
    [self.navigationController presentViewController:wallPostCreateViewController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

NSLog中imageView的输出是:

<UIImageView: 0x18f695b0; frame = (0 0; 640 640); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x18f14240>>
Run Code Online (Sandbox Code Playgroud)

框架对我的实际UIImageView来说太大了,它被设置为(60 227; 200 200)

我认为这就是我运行应用程序时根本无法看到UIImageView的原因.我该如何解决?

编辑:

在PAWWallPostCreateViewController.h中

@property (nonatomic, strong) IBOutlet UIImageView *imageView;
Run Code Online (Sandbox Code Playgroud)

我将imageView链接到我的.xib文件

熟悉autoresize = RM + BM的人也是; 因为通常当我使用imagePickerController将UIImage放在同一个视图控制器的UIImageView中时,我的UIImageView数据有一个autoresize = RM + BM; 属性所以我想要的代码通常看起来像

<UIImageView: 0x1a2b4b30; frame = (60 227; 200 200); opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x1a2b4bb0>>
Run Code Online (Sandbox Code Playgroud)

但现在,这就是我在这种情况下得到的结果

Pra*_*tel 5

只需在ViewDidLoad()中的第二个视图控制器下调用此行

self.imageView.contentMode = UIViewContentModeScaleAspectFit;
Run Code Online (Sandbox Code Playgroud)