2
나는 다음과 같은 NSSegmentedCell의 서브 클래스를 생성 drawWithFrame을 구현 한 드로잉 : 난에 마우스로 클릭하는 경우에만 세그먼트가 응용 프로그램의 처음 실행에 그려진되지 않은됩니다NSSegmentedCell 서브 클래스가
#import "CustomSegmentedCell.h"
@implementation CustomSegmentedCell
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
int i=0, count=[self segmentCount];
NSRect segmentFrame=cellFrame;
for(i=0; i<count; i++) {
segmentFrame.size.width=[self widthForSegment:i];
[NSGraphicsContext saveGraphicsState];
// Make sure that segment drawing is not allowed to spill out into other segments
NSBezierPath* clipPath = [NSBezierPath bezierPathWithRect: segmentFrame];
[clipPath addClip];
[self drawSegment:i inFrame:segmentFrame withView:controlView];
[NSGraphicsContext restoreGraphicsState];
segmentFrame.origin.x+=segmentFrame.size.width;
}
_lastDrawRect=cellFrame;
}
@end
문제를, 그것은 볼 얻는다 빈 영역 어디 세그먼트 화 된 컨트롤을 그려 가정합니다. 제발 알려주지, 여기에 무엇이 누락되었습니다.
감사합니다,
감사합니다 Parag 구현은, 요구 사항은 아주 나이,하지만 난 당신의 도움을 주셔서 감사합니다. – AmitSri