Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Jens Alfke
I haven't done much AppKit work in a while. Right now I have a small app where I'm trying to do something very simple: put a custom NSView in a window and make it scrollable. The view determines its own frame size based on the content it needs to display. So all I did was create a new window in

Re: Proper way to perform a task in the future on iOS 7 and 8

2015-05-05 Thread Fritz Anderson
On 4 May 2015, at 1:29 PM, Alex Zavatone wrote: > > Since the app is already receiving location updates in the background, does > it make sense to check if the current time is > than the expiry timestamp > within a location manager update? It makes so much sense to me that I don’t know why I’d

malloc(0) returns a pointer, not NULL

2015-05-05 Thread Michael David Crawford
This came as news to me. The C spec says this is implementation-definited; malloc(0 may return either NULL or it may return a pointer that can subsequently be passed to free(). In the case of the bug I'm looking at just now, it's an error in my code, so I now have: assert( 0 != bytes ); ptr = ma

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread David Durkee
Yes, this approach has worked much better. I see only two drawbacks. 1) The first time the menu is opened, it takes as much as two seconds for it to appear. This only seems to be true for the first instance of the menu that is opened. (It’s a popup menu in a document window, so different documen

Core Data sync between iOS and Mac apps

2015-05-05 Thread davelist
I'm looking into options for building an iOS and Mac app that can sync/share Core Data between them. I'm well aware of the issues with Core Data iCloud syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try it. The apps can have deployment targets of iOS 8 and greater and

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Lee Ann Rucker
On May 5, 2015, at 2:21 PM, David Durkee wrote: > Yes, this approach has worked much better. I see only two drawbacks. > > 1) The first time the menu is opened, it takes as much as two seconds for it > to appear. This only seems to be true for the first instance of the menu that > is opened.

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Graham Cox
> On 6 May 2015, at 2:26 am, Jens Alfke wrote: > > (although the view is pinned to the bottom of the window instead of the top > for some reason.) In the pre-autolayout days, this was always the case unless your embedded view returned YES for -isFlipped. Never made much sense then either.

Re: malloc(0) returns a pointer, not NULL

2015-05-05 Thread Jens Alfke
The Clang static analyzer will warn about potential calls to malloc(0). —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)list

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Jens Alfke
> On May 5, 2015, at 2:21 PM, David Durkee wrote: > > 1) The first time the menu is opened, it takes as much as two seconds for it > to appear. And it might take a lot longer than that, for a user with a lot of fonts installed. (I have nearly 2000.) It can also allocate a ton of RAM for glyph

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Jens Alfke
> On May 5, 2015, at 4:26 PM, Graham Cox wrote: > > I don’t know, but I also find setting up simple constraints baffling. Even > the most straightforward cases seem to be really hard to get right. Glad to know I'm not the only one. It wouldn't be so bad if there were some real documentation I

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread Graham Cox
> On 6 May 2015, at 7:21 am, David Durkee wrote: > > (the fonts I’m guessing)? > Why guess when you can measure? However it is almost certainly the fonts. No matter how you end up displaying them, you still need to initialize them at some point. You can probably warm up the Font Manager by

Re: Core Data sync between iOS and Mac apps

2015-05-05 Thread Jens Alfke
> On May 5, 2015, at 2:31 PM, davel...@mac.com wrote: > > I'm looking into options for building an iOS and Mac app that can sync/share > Core Data between them. I'm well aware of the issues with Core Data iCloud > syncing in iOS 5 and 6 and that it is supposedly better so I'm willing to try >

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Roland King
We did this a few months ago When you embed in a scrollview you end up with NSScrollView NSClipView Your View Constrain the scrollview to something above it if it needs it, if it’s the whole window, probably doesn’t. Constrain the clipview to all 4 sides of the scrollview. Const

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread dangerwillrobinsondanger
If you have AutoLayout on in a window it's actually on for all views. NSScrollView and its hierarchy are a bit weird though. Thing to do is create height and width constraints for the document view and outlets for them so you can configure them. If you're using 10.10+ you can make them configu

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Luther Baker
Not exactly the same but I found this doc helpful. https://developer.apple.com/library/ios/technotes/tn2154/_index.html Luther > On May 5, 2015, at 7:58 PM, dangerwillrobinsondan...@gmail.com wrote: > > If you have AutoLayout on in a window it's actually on for all views. > NSScrollView and it

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Jens Alfke
> On May 5, 2015, at 5:54 PM, Roland King wrote: > > Constrain the scrollview to something above it if it needs it, if it’s the > whole window, probably doesn’t. > Constrain the clipview to all 4 sides of the scrollview. > Constrain your view to the top, right and left of the clipview but not

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Jens Alfke
> On May 5, 2015, at 6:17 PM, Luther Baker wrote: > > Not exactly the same but I found this doc helpful. > > https://developer.apple.com/library/ios/technotes/tn2154/_index.html > I knew about that technote, but UIScrollVi

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread Roland King
> On 6 May 2015, at 09:21, Jens Alfke wrote: > > >> On May 5, 2015, at 5:54 PM, Roland King > > wrote: >> >> Constrain the scrollview to something above it if it needs it, if it’s the >> whole window, probably doesn’t. >> Constrain the clipview to all 4 sides of the scr

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread dangerwillrobinsondanger
Sent from my iPhone > On 2015/05/06, at 14:14, Roland King wrote: > > One of the things you ‘pick up’ as you learn autolayout is that when frame > sizes disappear to {0,0} that often means you have an ambiguous layout and > you need more constraints. More precisely it means a view is either

Re: Help: NSScrollView is resizing its documentView down to (0, 0)

2015-05-05 Thread dangerwillrobinsondanger
Sent from my iPhone > On 2015/05/06, at 9:58, dangerwillrobinsondan...@gmail.com wrote: > > If you have AutoLayout on in a window it's actually on for all views. > NSScrollView and its hierarchy are a bit weird though. > Thing to do is create height and width constraints for the document view

Re: malloc(0) returns a pointer, not NULL

2015-05-05 Thread Clark Smith Cox III
> On May 5, 2015, at 14:19, Michael David Crawford wrote: > > This came as news to me. > > The C spec says this is implementation-definited; malloc(0 may return > either NULL or it may return a pointer that can subsequently be passed > to free(). Note that even when it does return NULL, that i