So I have the following code:
#define degreesToRadians(x) (M_PI * x / 180.0)
@implementation NewsFeedSubCell
@synthesize imageView_;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
CGRect frame = self.frame;
frame.size.width = 20;
frame.size.height = 20;
self.frame = frame;
self.contentView.frame = frame;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.frame];
imageView.transform = CGAffineTransformRotate(self.contentView.transform, degreesToRadians(90));
[imageView setAutoresizingMask:UIViewAutoresizingNone];
[self.contentView addSubview:imageView];
self.imageView_ = imageView;
[imageView release];
}
return self;
}
Any idea why this is not rotating?
Why are you taking the transform of the contentView? Try to use CGAffineTransformMakeRotation
instead of CGAffineTransformRotate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.