Re: updates for retina
On Jun 15, 2012, at 9:21 AM, Roland King wrote: I didn't find a document describing 'all the things you might have to do to make your application retina-compatible', is there one? High Resolution Guidelines for OS X https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html Lion AppKit release notes, Changes for Resolution Independence. https://developer.apple.com/library/mac/releasenotes/Cocoa/AppKit.html#10_7HighResolution Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [SOLVED] Re: How to override [NSTextField paste:]
On Jun 15, 2012, at 4:23 PM, Graham Cox graham@bigpond.com wrote: On 16/06/2012, at 4:06 AM, Kyle Sluder wrote: Your best bet is probably to retarget the Paste menu item to use a different selector that is picked up by your window controller. Thanks Kyle, Unfortunately the standard paste: selector is used extensively elsewhere in my app, so this simple solution would not be so simple. This is an otherwise very self-contained modal dialog that doesn't have much to do. The good thing about this solution is that it does fall back to sending -paste:. But you are right; it does seem a bit heavy-handed for your localized need. I solved it as follows: My window controller, which is the window's delegate, implements -windowWillReturnFieldEditor:forObject:. I return a subclass of NSTextView which overrides -paste: and adds a property, -pasteDelegate: which I set to be the window controller. (I believe the FE's nextResponder is usually also the windowController, but I wasn't entirely sure I could rely on that, so I just added an extra property to hook it up). Then I just punt -paste to the -pasteDelegate (and also -validateMenuItem for that action). Cool. In order to avoid a retain cycle or a dangling pointer, instead of using a pasteDelegate (since there's no clear place to nil the property out) I would probably just use [[self window] windowController]. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CALayer contentScale initialization, where to do it?
Hello, I have a number of layer hosting custom views (which are all delegate-drawn) and I'm pulling my hair out to find a good place to initialize the contentScale layer property. I usually create the layers (if there's a fixed number of them) in the view's -initWithFrame:. At that point the view doesn't have a window, so I can't set contentScale correctly (by getting the window's backingScaleFactor). One place would be -viewDidMoveToWindow: but I hope there's a better way. For some views the layer hierarchies and ownerships are complicated and dynamic and getting the window's backingScaleFactor would require unwanted links back to the view through a complex object hierarchy in order to get that value. The comment on -layer:shouldInheritContentsScale:fromWindow: in the NSLayerDelegateContentsScaleUpdating informal protocol (new in 10.7.4 I think, NSView.h line 405) seems to indicate the existence of a property or method named initialContentsScale, though I can't find any mention anywhere else. Any ideas? Regards Markus -- __ Markus Spoettl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer contentScale initialization, where to do it?
On Jun 16, 2012, at 4:13 AM, Markus Spoettl ms_li...@shiftoption.com wrote: I usually create the layers (if there's a fixed number of them) in the view's -initWithFrame:. At that point the view doesn't have a window, so I can't set contentScale correctly (by getting the window's backingScaleFactor). Is this strategy documented somewhere? The High-Resolution Guide says to avoid looking at the windows backingScaleFactor at all, but it's very sparse on details about supporting CALayer. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[ANN] MPWDrawingContext, pleasant Objective-C drawing context
MPWDrawingContext is a light-weight Objective-C wrapper around CoreGraphics CGContextRef and corresponding functions. Code is on Github:https://github.com/mpw/MPWDrawingContext Infrequently Asked Questions: Why would anyone need an Objective-C drawing context? In short, while CoreGraphics is an awesome graphics subsystem, not having OO features makes CGContext closed to extension by anyone but Apple, and somewhat unpleasant to use, IMHO. I explain a bit more about the motivation on my blog: http://blog.metaobject.com/2012/06/pleasant-objective-c-drawing-context.html Who cares about possible future expansion when that means there's lots of code to integrate with nasty dependencies? 1 Class, 1 Protocol, 3 extra include files to equalize some of the differences between iOS and OSX (could probably be reduced). 1 additional class (MPWView) is purely optional In the github project, the code is actually integrated into an adapted version of Matt Gallagher's IconApp, so you have a working example right there. But Cocoa has some fine drawing functionality with NSBezierPath, NSAffineTransform and friends True, but MPWDrawingContext works identically on both iOS and Mac OS X. In fact there's also an MPWView class that works on both iOS and OSX, which is used in the sample code mentioned above to create an iOS app using the same drawing code as the OS X app. I also prefer my graphics context to not be a hidden global parameter that's implicitly used by a bunch of other objects. Who cares about OSX ^ iOS? Based on my unscientific experiments, MPWDrawingContext reduces the code I have to write for even one of the two platforms by about 20-30%. Your mileage will almost certainly vary. Who cares about less code? Well, it\s not just less code, it's more pleasant code as well: [context moveto:0 :0] lineto:100 :0] lineto:50 :50] closepath] stroke]; vs. CGContextMoveToPoint( context, 0, 0 ); CGContextAddLineToPoint( context, 100, 0); CGContextAddLineToPoint( context, 50, 50 ); CGContextClosePath( context ); CGContextFillPath( context ); And bitmapContext = [MPWCGDrawingContext rgbBitmapContext:NSMakeSize( 595, 842 )]; vs. bitmapContext = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast) | kCGBitmapByteOrderDefault ); No it's not! OK :-) Marcel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer contentScale initialization, where to do it?
On 6/16/12 8:08 PM, Kyle Sluder wrote: I usually create the layers (if there's a fixed number of them) in the view's -initWithFrame:. At that point the view doesn't have a window, so I can't set contentScale correctly (by getting the window's backingScaleFactor). Is this strategy documented somewhere? The High-Resolution Guide says to avoid looking at the windows backingScaleFactor at all, but it's very sparse on details about supporting CALayer. https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html talks a little about layers but is rather unclear on how and when to initalize a layer contentScale properly. I don't recall reading about avoiding backingScaleFactor, though. Regards Markus -- __ Markus Spoettl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Simple question driving me CRAZY
I have a subclass of a NSViewController. In fact, I created on just as a test with no custom code. I then throw an NSTextView in the NSView that comes with it and then drag from the NSTextView to the .h file to create an outlet. Why why why is it making it unsafe_unretained? I'm using ARC. Why it's it weak like every other subview? The NSTextView is in a NSScrollView which is in the controllers NSView. The NSScrollView is coming in as weak. It's been diving me insane all day. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Simple question driving me CRAZY
From http://developer.apple.com/library/mac/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW17: Which classes don’t support weak references? You cannot currently create weak references to instances of the following classes: NSATSTypesetter, NSColorSpace, NSFont, NSFontManager, NSFontPanel, NSImage, NSMenuView, NSParagraphStyle, NSSimpleHorizontalTypesetter, NSTableCellView,NSTextView, NSViewController, NSWindow, and NSWindowController. In addition, in OS X no classes in the AV Foundation framework support weak references. For declared properties, you should use assign instead of weak; for variables you should use __unsafe_unretained instead of __weak. In addition, you cannot create weak references from instances of NSHashTable, NSMapTable, or NSPointerArray under ARC. HTH, Dave On Jun 16, 2012, at 2:06 PM, Brad Stone wrote: I have a subclass of a NSViewController. In fact, I created on just as a test with no custom code. I then throw an NSTextView in the NSView that comes with it and then drag from the NSTextView to the .h file to create an outlet. Why why why is it making it unsafe_unretained? I'm using ARC. Why it's it weak like every other subview? The NSTextView is in a NSScrollView which is in the controllers NSView. The NSScrollView is coming in as weak. It's been diving me insane all day. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com This email sent to davedel...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [ANN] MPWDrawingContext, pleasant Objective-C drawing context
On Jun 16, 2012, at 12:37 PM, Marcel Weiher wrote: MPWDrawingContext is a light-weight Objective-C wrapper around CoreGraphics CGContextRef and corresponding functions. This sounds really cool and useful! What version of MPW do I need to build/run it? (—joke for old-timers) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer contentScale initialization, where to do it?
On Jun 16, 2012, at 1:53 PM, Markus Spoettl ms_li...@shiftoption.com wrote: On 6/16/12 8:08 PM, Kyle Sluder wrote: I usually create the layers (if there's a fixed number of them) in the view's -initWithFrame:. At that point the view doesn't have a window, so I can't set contentScale correctly (by getting the window's backingScaleFactor). Is this strategy documented somewhere? The High-Resolution Guide says to avoid looking at the windows backingScaleFactor at all, but it's very sparse on details about supporting CALayer. https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html That's the same document I was referring to. But it also contains this very useful section, titled Manage Core Animation Layer Contents And Scale: https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW27 Specifically, it looks like you want to implement -layer:shouldInheritContentsScale:fromWindow: on your layer delegates. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer contentScale initialization, where to do it?
On 6/16/12 11:59 PM, Kyle Sluder wrote: That's the same document I was referring to. But it also contains this very useful section, titled Manage Core Animation Layer Contents And Scale: https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW27 Specifically, it looks like you want to implement -layer:shouldInheritContentsScale:fromWindow: on your layer delegates. I know, see my first message. It's the initialization I'm talking about, this delegate helps when contentsScale changes. Regards Markus -- __ Markus Spoettl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com