将imageView添加为subView

时间:2014-05-14 19:27:59

标签: ios imageview

如何将imageView作为subView添加到imageView到内容端? 我需要在其内容大小中添加imageView的偏移量

我的代码不起作用

 imageView.frame = CGRectMake(0, imageView.subviews.count * _mageView.frame.size.height + _imageView.frame.origin.y , _screenWidth, _image.size.height);

1 个答案:

答案 0 :(得分:0)

首先回答第二个问题,你可能会看CGRectOffset(CGRect rect, x, y) 其中rect是原始矩形,x和y是新矩形偏离原始矩形的值。您可以使用此语句来定义imageView.frame

的值

对于第一个问题,将imageView添加为mainView的子视图:[mainView addSubview:imageView]

相关问题