• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSGradient & NSTextField’s focus ring
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSGradient & NSTextField’s focus ring


  • Subject: Re: NSGradient & NSTextField’s focus ring
  • From: Yilei He <email@hidden>
  • Date: Tue, 21 Feb 2017 08:44:13 +1100

My whole view's code:
import Cocoa

class GradientBackgroundView: NSView {

override func draw(_ dirtyRect: NSRect) {
let gradient = NSGradient(colors: [
NSColor(calibratedWhite: 0.96, alpha: 1),
NSColor(calibratedWhite: 0.84, alpha: 1)
])

gradient?.draw(in: dirtyRect, angle: 270)

let path = NSBezierPath()
path.move(to: NSPoint(x: 0, y: 0))
path.line(to: NSPoint(x: dirtyRect.maxX, y: 0))
NSColor.darkGray.setStroke()
path.stroke()
}

}

Cheers
Yilei He

On 21 Feb 2017, 04:18 +1100, David Duncan <email@hidden>, wrote:
>
> > On Feb 20, 2017, at 2:41 AM, Yilei He <email@hidden> wrote:
> >
> > Hi
> >
> > In my UI design, I have a custom NSView which only draws a NSGradient in draw(in:) method. I also have a NSTextField next to this custom view. Every time when text field is focused, the focus ring animates and leave a set of mark(animation tracks) on the custom view.
>
> Can you share your draw(in:) implementation?
>
> >
> > After I tested this for a while, I found that the focus ring only leaves marks on gradient.
> >
> > Can anyone give a solution to remove the mark?
> >
> > Thanks
> > Yilei He
> >
> >
> > _______________________________________________
> >
> > Cocoa-dev mailing list (email@hidden)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
>
> --
> David Duncan
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSGradient & NSTextField’s focus ring
      • From: David Duncan <email@hidden>
References: 
 >NSGradient & NSTextField’s focus ring (From: Yilei He <email@hidden>)
 >Re: NSGradient & NSTextField’s focus ring (From: David Duncan <email@hidden>)

  • Prev by Date: Re: NSGradient & NSTextField’s focus ring
  • Next by Date: Re: NSGradient & NSTextField’s focus ring
  • Previous by thread: Re: NSGradient & NSTextField’s focus ring
  • Next by thread: Re: NSGradient & NSTextField’s focus ring
  • Index(es):
    • Date
    • Thread