0

所以我有以下代码:

#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;
}

知道为什么这不旋转吗?

4

1 回答 1

2

为什么要对 contentView 进行转换?尝试使用CGAffineTransformMakeRotation而不是CGAffineTransformRotate

于 2012-05-02T00:06:27.517 回答