2012-05-09 36 views
0

我有一個UIView,我想添加一個圖像作爲它的子視圖([view addSubview:imageView])。我想知道如何設置imageView的大小以適應UIView的大小(通過編程)。默認情況下,圖像太大而無法顯示。如何適合imageview的大小到它的父親視圖

回答

0

你可以設置圖像視圖的幀等於查看,就像 -

imageView.frame = self.view.frame 
0

使用本

[imageView setFrame:CGRectMake(self.view.origin.x, self.view.origin.y, elf.view.bounds..size.width, self.view.bounds.size.height)]; 
1

當一個孩子的看法它的父範圍內工作,它應該使用父母的界限,而不是父母的框架。

imageView.frame = self.bounds.frame 
相關問題