Best practices with singletons

2014-06-08 Thread William Squires
Okay, I have several classes in my (somewhat large, and growing) project that implement the singleton pattern via a [classname sharedwhatever] class method (and a file-scope static reference) that uses lazy loading to instantiate the singleton the first time a reference is asked for. Is it

Re: Best practices with singletons

2014-06-08 Thread Jens Alfke
On Jun 8, 2014, at 9:30 AM, William Squires wsqui...@satx.rr.com wrote: Is it considered better to put all of these calls in the main() function before any other code executes, or not worry about it, and just access them through the above class methods when and where needed? I wouldn’t

File's owner in nib file

2014-06-08 Thread Miguel Carvajal
I created a new NSWindow in interface builder and using a NSWindowController i pr ogrammatically load the window from the nib and show it, but once i close the window, i don' t get it show again. Some digging in stackoverflow revealed me that it happens that way because i have to set the File's

Re: Best practices with singletons

2014-06-08 Thread Seth Willits
The practical answer in short is: Just always access through +sharedInstance, no need to pre-initialize, and only use it on the main thread. This is one of those threads that will easily become a stupidly long debate that's been had a dozen times before. If you're interested in all of the

Re: File's owner in nib file

2014-06-08 Thread Seth Willits
On Jun 8, 2014, at 12:07 PM, Miguel Carvajal krvajal.miguelan...@gmail.com wrote: I created a new NSWindow in interface builder and using a NSWindowController i pr ogrammatically load the window from the nib and show it, but once i close the window, i don' t get it show again. Some digging

Re: File's owner in nib file

2014-06-08 Thread Seth Willits
On Jun 8, 2014, at 12:23 PM, Seth Willits sli...@araelium.com wrote: Whether a window will appear or not has nothing to do with File's Owner. Your window is probably marked as Release When Closed in IB. It's shown once the first time, but after closing it it's deallocated and no longer

Re: Best practices with singletons

2014-06-08 Thread Graham Cox
On 9 Jun 2014, at 2:30 am, William Squires wsqui...@satx.rr.com wrote: uses lazy loading to instantiate the singleton the first time a reference is asked for. Sounds good. Is it considered better to put all of these calls in the main() function before any other code executes, Huh? or

Re: Another dumb question about NSWindowController(s)

2014-06-08 Thread Graham Cox
On 8 Jun 2014, at 7:32 am, Lee Ann Rucker lruc...@vmware.com wrote: Delete that init method. Xcode has a standard template and doesn't change it when you tick the make a xib file checkbox. I really wish Xcode would allow us to make our own templates, even for NSxxx classes. The templates

Re: Another dumb question about NSWindowController(s)

2014-06-08 Thread Eric Shepherd
On Jun 8, 2014, at 8:16 PM, Graham Cox graham@bigpond.com wrote: On 8 Jun 2014, at 7:32 am, Lee Ann Rucker lruc...@vmware.com wrote: Delete that init method. Xcode has a standard template and doesn't change it when you tick the make a xib file checkbox. I really wish Xcode would

Re: Another dumb question about NSWindowController(s)

2014-06-08 Thread Shane Stanley
On 9 Jun 2014, at 10:16 am, Graham Cox graham@bigpond.com wrote: I really wish Xcode would allow us to make our own templates, even for NSxxx classes. You can. Copy this: /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Cocoa/Objective-C

Re: Another dumb question about NSWindowController(s)

2014-06-08 Thread Graham Cox
On 9 Jun 2014, at 11:04 am, Shane Stanley sstan...@myriad-com.com.au wrote: You can. Thanks! There's my morning's productivity gone, but I fully expect it to pay itself back. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

OpenGL and crawling ants

2014-06-08 Thread Todd Heberlein
I've just started playing with OpenGL, and I'm trying to use GLKBaseEffect and GLKTextureInfo in part to avoid writing my own shaders, but I'm getting a crawling ants effect. I have a texture that is a square with black edges. For the floor I essentially have a series of rectangles on which

Re: OpenGL and crawling ants

2014-06-08 Thread Seth Willits
On Jun 8, 2014, at 6:50 PM, Todd Heberlein todd_heberl...@mac.com wrote: http://www.toddheberlein.com/blog/2014/6/8/opengl-and-crawling-ants Use mipmaps, and if that's still not high enough quality, anisotropic filtering. -- Seth Willits ___

Re: NSAlert - Default Cancel also respond to Escape? [Solution]

2014-06-08 Thread Seth Willits
On May 19, 2014, at 1:30 PM, Seth Willits sli...@araelium.com wrote: Any ideas on how to get a Cancel button which is both the default button and responds to escape? Both require setting the button's key equivalent and there can only be one. Desired Behavior: Delete - First

Re: Another dumb question about NSWindowController(s)

2014-06-08 Thread Eric Shepherd
Anyone have awesome templates to share? :) Eric Shepherd Sent from my iPhone On Jun 8, 2014, at 9:04 PM, Shane Stanley sstan...@myriad-com.com.au wrote: On 9 Jun 2014, at 10:16 am, Graham Cox graham@bigpond.com wrote: I really wish Xcode would allow us to make our own templates, even

Conditionally allowing multiple selections in NSOutlineView

2014-06-08 Thread Graham Cox
An NSOutlineView's rows represent different objects. Some of these can have a multiple selection, and some can't. For example, child objects of a particular object can have a multiple selection within that group, but there can't be a multiple selection in different groups, nor can more than one

Re: Conditionally allowing multiple selections in NSOutlineView

2014-06-08 Thread Quincey Morris
On Jun 8, 2014, at 21:46 , Graham Cox graham@bigpond.com wrote: Can anyone think of a way to achieve this? 'outlineView:selectionIndexesForProposedSelection:’ ? It’s preferred over ‘outlineView:shouldSelectItem:’ these days anyway. ___

Re: Notification Center

2014-06-08 Thread 2551
Thanks, Kyle. That worked perfectly. The steps, in case anyone else needs it, to ensure notifications get delivered to the screen and not just to the notification center: 1. add NSUserNotificationCenterDelegate to the header file: ..., NSUserNotificationCenterDelegate 2. In your delegate.m