开发者

Rotating UIView and still seeing the old position of the view

I am rotating a view using src.transform = CGAffineTransformMakeRotation(M_PI/2);, it is 开发者_如何学Cworking well but I am still seeing the old position of the view (like that: http://cl.ly/233y403c2C1C451r1f28).

How can I refresh the view ? The view is in a UITableViewCell, I tried to refresh the row of the cell or even the tableview but it doesn't work.

Here is my drawRect method :

  if (nil != _image) {
    [_image drawInRect:rect contentMode:self.contentMode];
  } else {
    [_defaultImage drawInRect:rect contentMode:self.contentMode];
  }

The view that I am rotating is embedded in a UIImageView which is part of the cell.

Thanks, Martin


It sounds like you might have two copies of your image view there. When you rotate the top one, the bottom one is exposed.


What is the background colour of the UIView you're overriding drawRect in? Before drawRect is called, the background colour is applied to the context. Ensure you have a background colour set (i.e. not set to [UIColor clearColor], for example).

Also, what's the opaque property of your UIView set to?


If figured it out. I was trying to rotate the image while I was downloading it. When I rotate it from a delegate callback that is call when the image is loaded everything works fine.
All of that makes perfect sense !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜