我有一個UIYableView,並且我在該tableview中保留圖像,每次旋轉手機時都會更改UIImageView的大小。我檢查了tableView:cell:forIndexpath中的self.interfaceOrientation,並決定給imageview提供什麼樣的尺寸。每當旋轉發生時,我關閉cource重新加載tableview。但旋轉後,圖像似乎混合。我的意思是我在另一幅圖像上得到了一幅圖像的一部分。解決這個問題的最佳方法是什麼?旋轉後圖像變壞
編輯:添加一些代碼
在實現代碼如下:細胞:forIndexPath方法我做到以下幾點:
...............
NSUIinteger row=indexPath.row;
UIImageView *imageView=[[UIIMage alloc]initWithImage:[images ojectAtIndex:row]];
if(self.interfaceOrientation==UIInterfaceOrientationPortrait)
imageView.Frame.Size=CGSizeMake(320.0,460.0);
else
imageView.Frame.Size=CGSizeMake(480.0,300.0);
imageView.contentMode=UIContentModeAspectFit;
[cell.contentView addSubView:imageView];
在tableview中
:身高:forIndexPath方法:
double height;
if(self.interfaceOrientation==UIInterfaceOrientationPortrait)
height=460;
else
height=300;
return height;
我回行的寬度也是一樣。
你需要展示一些代碼讓我們瞭解你在做什麼。 – jv42 2011-06-16 12:06:41