如果我没有连接到文本字段,那么UIImageView的大小调整就可以了。如果我写入文本区域,则调整大小失败。我不知道为什么写入文本会对UIImageView的大小调整产生负面影响。
@interface rjhccViewController ()
@end
@implementation rjhccViewController
-(IBAction)myButtonPress{
UIImage *img = [UIImage imageNamed:@"p.png"];
[testcontainer setImage:img];
[testcontainer setFrame:CGRectMake(0.0,0.0,50.0, 50.0)];
[self labelHeight:img];
}
-(void)labelHeight: (UIImage *) myimage{
//self.heightS.text = [NSString stringWithFormat:@"%d",(int)myimage.size.height];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidUnload {
[self setHeightS:nil];
[super viewDidUnload];
}
@end