Re: Drawing same text and graphics in different CGContextRef

2023-09-22 Thread David Duncan via Cocoa-dev
> On Sep 22, 2023, at 12:44 PM, JPH wrote: > > Hi David, > > Trying to understand the mechanism you suggest ( I am not familiar with > the concept of context pushing - poping :(I ) > > NSGraphicsContext * newcontext= > [NSGraphicsContex >

Re: Drawing same text and graphics in different CGContextRef

2023-09-22 Thread David Duncan via Cocoa-dev
> On Sep 22, 2023, at 11:12 AM, JPH via Cocoa-dev > wrote: > > I am facing the following problems in drawing text and graphics in > CGContextRef of an NSview and Printing framework: > > 1) drawing text using: [finalString drawInRect:textBox > withAttributes:attributes]; > Works

Re: CALayer shadows and CGContext clip rect

2023-01-03 Thread David Duncan via Cocoa-dev
While you may have solved your problem, your general approach is not one that would be recommended – CALayers are not meant to be drawn into a context, but rather added to a layer tree to be rendered by the system. For what you are doing you would likely have less issue and better performance

Re: iOS UINavigation background removal.

2022-01-28 Thread David Duncan via Cocoa-dev
> On Jan 28, 2022, at 11:50 AM, Alex Zavatone wrote: > > Awesome. Thank you, David. > > > I stumbled across this too while going through Apple documentation. What’s > scary is that I have no idea why it works. > > self.navigationController!.navigationBar.barStyle = .default >

Re: iOS UINavigation background removal.

2022-01-28 Thread David Duncan via Cocoa-dev
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new]; [appearance configureWithTransparentBackground]; navigationItem.standardAppearance = appearance; Thats the simplest per-item way to do it. This does imply you adopt the new appearance APIs introduced in iOS 13. > On Jan

Re: Accessibility UIContentSizeCategory or current accessibility font setting

2021-10-18 Thread David Duncan via Cocoa-dev
> On Oct 18, 2021, at 10:51 AM, Alex Zavatone wrote: > > > >> On Oct 18, 2021, at 11:31 AM, David Duncan wrote: >> >> In general it's also preferred that you look at the traitCollection of the >> most relevant view for this information – there are contexts for which the >> content size

Re: Accessibility UIContentSizeCategory or current accessibility font setting

2021-10-18 Thread David Duncan via Cocoa-dev
In general its also preferred that you look at the traitCollection of the most relevant view for this information – there are contexts for which the content size category may not match the global value (and there is API on UIView to restrict the overall range that you can apply as well). This

Re: Scaling a UIImage

2020-11-02 Thread David Duncan via Cocoa-dev
> On Nov 2, 2020, at 3:20 PM, Carl Hoefs wrote: > > Okay. It was my understanding that -TIFFRepresentation was the only way to > get serializable image data bytes... What is a more efficient way to do this? If you want serializable data bytes, sure, but thats not what you appear to be doing

Re: Scaling a UIImage

2020-11-02 Thread David Duncan via Cocoa-dev
> On Nov 2, 2020, at 2:59 PM, Carl Hoefs via Cocoa-dev > wrote: > > How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels? > > > I have an iOS app that interacts with a macOS server process. The iOS app > takes a 3264x2448 camera image, scales it to 640x480 pixels, and

Re: Throttling drawing to vertical refresh

2020-10-23 Thread David Duncan via Cocoa-dev
> On Oct 23, 2020, at 8:54 AM, Andreas Falkenhahn > wrote: > > Thanks, but once again, I still need a throttle because I obviously don't > want to call -setNeedsDisplay as often as the CPU permits, thereby causing > 100% CPU load. I still need some timer mechanism that only calls >

Re: Problem in the creation of Graphics context(NSGraphicsContext)

2020-03-04 Thread David Duncan via Cocoa-dev
You’ll need to explain how you are creating the NSBitmapImageRep (what methods your calling, what parameters your passing, etc) that you pass to this method before anyone can explain why this might be going wrong for you. > On Mar 3, 2020, at 10:19 PM, Sravan Kumar Lakkimsetti via Cocoa-dev >

Re: UIView block-based methods

2019-11-11 Thread David Duncan via Cocoa-dev
> On Nov 9, 2019, at 12:09 PM, Carl Hoefs via Cocoa-dev > wrote: > > I'm trying to keep some older iOS code going, but I'm getting a deprecation > warning on many UIView class methods: > > +beginAnimations:context: > +setAnimationBeginsFromCurrentState: > +setAnimationDuration: >

Re: Subclassing NSCollectionViewFlowLayout

2019-10-21 Thread David Duncan via Cocoa-dev
> On Oct 21, 2019, at 3:26 AM, Arved von Brasch via Cocoa-dev > wrote: > > Hello list, > > Thanks to someone on the list who provided me with a clue, I found that if I > add this to my NSCollectionViewItem subclass: > > override func viewWillAppear() { >super.viewWillAppear() >

Re: Alerts in Xcode 11

2019-09-30 Thread David Duncan via Cocoa-dev
Instead of creating a new window and a root view controller in order to present your alert, just use (assuming self is a UIViewController) self.present(, animated: completion: …) > On Sep 30, 2019, at 5:48 PM, Doug Hardie wrote: > > Not sure how to do that. It's not in any view controller as

Re: Alerts in Xcode 11

2019-09-30 Thread David Duncan via Cocoa-dev
What happens if you present it over your normal view controller hierarchy instead of using another window? Has your application adopted UIWindowScene? > On Sep 30, 2019, at 5:36 PM, Doug Hardie via Cocoa-dev > wrote: > > I have some code that presents an alert to the user with information

Re: Pausing an animation

2019-09-17 Thread David Duncan via Cocoa-dev
> On Sep 17, 2019, at 1:19 PM, Gabriel Zachmann via Cocoa-dev > wrote: > > I have a layer with two animations. > > I would like to pause this animation occasionally . > To do so, I set layer.speed = 0.0; > > In the past, this has worked (with slightly different animations). > However, in

Re: CABasicAnimation does not animate bounds.origin of a layer

2019-09-16 Thread David Duncan via Cocoa-dev
> On Sep 14, 2019, at 6:25 AM, Gabriel Zachmann via Cocoa-dev > wrote: > > Maybe, I haven't understood how the animation of the bounds property works, > or the bounds property of a CALayer itself , > or I am making a stupid mistake. > > Here is my code: > >CALayer * imgLayer =