سؤال

أقوم بعمل فئة فرعية من NSLevelIndicatorCell وأريد أن أرسمها رأسياً. هذا لا يعمل ، ماذا أفعل خطأ؟

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform rotateByDegrees:90];
[transform concat];
[super drawWithFrame:cellFrame inView:controlView];
[[NSGraphicsContext currentContext] restoreGraphicsState];}
هل كانت مفيدة؟

المحلول

[self setBoundsRotation:90];

[self setNeedsDisplay];

الآن ، أنا فقط بحاجة إلى معرفة كيفية الحصول على الحواف التي يمكن إصلاحها للتغيير من الأفقي إلى العمودي ...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top