我有一个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