开发者

Resize UIImageView in UITableViewCell upon rotation

I'm setting a UIImageView into my table cells during - (UITableViewCell *)tableView:(UITableView *)tableVw cellForRowAtIndexPath:(NSIndexPath *)indexPath

They are stretchable images (created with stretchableImageWithLeftCapWidth)

How can I update their size when my table vi开发者_运维百科ew is rotated to another orientation?


First, create an IBOutlet for each object to be resized. Open interface builder and connect the outlets to your file's owner.

You will need to override the method

willAnimateFirstHalfOfRotationToInterfaceOrientation:duration

This is for making changes that will happen before the roation animation is finished, or you could use

willAnimateSecondHalfOfRotationToInterfaceOrientation:duration

if you want the new positioning to occur at the same time the rotation finishes.

Inside the animate method, you will redraw the frame depending on which orientation the phone is now in: Example:

button1.frame = CGRectMake(20, 20, 125, 125);

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜