私は次のコードを持っています:
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
float imageHeight = self.image.size.height;
float imageWidth = self.image.size.width;
float ratio = imageHeight/imageWidth;
if(imageHeight> MAX_IMAGE_HEIGHT){
imageHeight = MAX_IMAGE_HEIGHT;
imageWidth = imageHeight/ratio;
}
if(imageWidth > MAX_IMAGE_WIDTH){
imageWidth = MAX_IMAGE_WIDTH;
imageHeight = imageWidth*ratio;
}
CGFloat yCoord = (self.bounds.size.height - imageHeight) / 2;
[self.image drawInRect:CGRectMake(10.0f, yCoord, imageWidth, imageHeight)];
yCoord = (self.bounds.size.height - MAIN_FONT_SIZE) / 2;
CGPoint point = CGPointMake(10.0 + imageWidth + 10.0, yCoord);
[self.title drawAtPoint:point
forWidth:self.bounds.size.width - (10.0 +imageWidth+20.0)
withFont:[UIFont systemFontOfSize:MAIN_FONT_SIZE]
minFontSize:MIN_MAIN_FONT_SIZE
actualFontSize:NULL
lineBreakMode:NSLineBreakByTruncatingTail
baselineAdjustment:UIBaselineAdjustmentAlignBaselines];
}
この問題をコンパイルしたとき、drawAtPoint の非推奨コードについて私は、DrawInRect に変更する必要があることを提案しました...しかし、SDK ドキュメントでさえ、ここでいくつかの投稿を既に見ましたが、私の問題については、これを管理する方法がわかりません...