nac*_*o4d 1 macos cocoa objective-c nswindow
我已经将NSWindow子类化了,所以我可以做一些调整并有一个自定义窗口.其中之一是使底角变圆但尚未成功.
我试过这个但是我的窗口没有标准的状态栏它没有用.我希望这是可能的;)
提前致谢
由于我的窗口有样式:NSBorderlessWindowMask我通过继承窗口的containerView并覆盖drawRect来解决这个问题:
- (void) drawRect:(NSRect)dirtyRect{
[[NSColor windowBackgroundColor] set];
[NSGraphicsContext saveGraphicsState];
NSBezierPath *path;
path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:5 yRadius:5];
... // do more fancy stuff here ;)
[NSGraphicsContext restoreGraphicsState];
}
Run Code Online (Sandbox Code Playgroud)