[Objective-C] 在cell的范围中画一个标准的焦点环 →→→→→进入此内容的聊天室

来自 , 2021-01-19, 写在 Objective-C, 查看 176 次.
URL http://www.code666.cn/view/8471bda5
  1. - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
  2. {
  3.     // other stuff might happen here
  4.     if ([self showsFirstResponder]) {
  5.          // showsFirstResponder is set for us by the NSControl that is drawing  us.
  6.         NSRect focusRingFrame = cellFrame;
  7.         focusRingFrame.size.height -= 2.0f;
  8.         [NSGraphicsContextsaveGraphicsState];
  9.         NSSetFocusRingStyle(NSFocusRingOnly);
  10.         [[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame, 4.0f, 4.0f)] fill];
  11.         [NSGraphicsContext restoreGraphicsState];
  12.     }
  13.     // other stuff might happen here
  14. }
  15.                                                
  16.  
  17. //objectc/152

回复 "在cell的范围中画一个标准的焦点环"

这儿你可以回复上面这条便签

captcha