
- (NSRect)imageFrame
{
NSRect imageFrame;
NSRect frame;
CGFloat maxHeight;
CGFloat ratio;
// Work around code for Mac OS X 10.7.x Lion's bug.
frame = [super frame];
imageFrame = [super imageFrame];
maxHeight = NSHeight(frame) - 20;
if(NSWidth(imageFrame) > maxHeight) {
ratio = maxHeight / NSWidth(imageFrame);
imageFrame.size = NSMakeSize(maxHeight, NSHeight(imageFrame) * ratio);
imageFrame.origin = NSMakePoint(NSMidX(frame) - NSWidth(imageFrame) / 2,
NSMidY(frame) - NSHeight(imageFrame) / 2 + 10);
}
return imageFrame;
}
0 件のコメント:
コメントを投稿