-1

When I call setImage the UIImageView resizes:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil title:(NSString *)t distance:(NSString *)d image:(UIImage *)i{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        name = [t retain];
        distance = [d retain];
        image = [i retain];

    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [marketImage setImage:image];
}

If the image is larger than the UIImageView the UIImageView resizes. I did not call sizeToFit so I dont know why this would happen. Any reason why I encounter a resize?

Should I uncheck autoresize subviews?

4

1 回答 1

0

发现问题:

在 IB 中,如果您使用导入的图片设置图像,则调用

[image setImage:newImage]         

IOS 将调整 UIImageView 的大小,但如果您在 IB 中将图像留空,则它不会调整大小。

于 2013-07-06T00:10:58.013 回答