Re: Embedded Collection View Controller scrolling issue

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 23:45 , Doug Hill  wrote:
> 
> I'm still looking for other ways to track this down.

I think you’re going to have to submit a bug report or use a TSI to get Apple 
to tell you what to do.

___

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: Embedded Collection View Controller scrolling issue

2017-06-19 Thread Doug Hill
Hello Quincey,

First, I should have originally made clear this is iOS, apologies. Also, to 
clarify, I am talking about the drag-scroll gesture, which would be the Pan 
gesture. 

The scroller-within-a-scroller is definitely more complex but I've usually made 
them work in previous view controllers I've developed. Like you, I don't really 
have a great idea of what is happening under the hood in these various 
UIScrollviews. Or even a good idea how to debug what seems like lower-level 
stuff.
Thinking about it more, I might look into priorities of the gesture 
recognizers, since this sounds like it could be related. Otherwise, I'm still 
looking for other ways to track this down.

Thanks again.

Doug Hill


> On Jun 19, 2017, at 11:29 PM, Quincey Morris 
>  wrote:
> 
> On Jun 19, 2017, at 16:22 , Doug Hill  > wrote:
>> 
>> The embedded collection view will only scroll if I drag on the area of the 
>> collection view that is originally visible.
> 
> Can you clarify this a bit? Are you talking about the autoscrolling that 
> happens when you drag-select, or scrolling that happens when you use a scroll 
> gesture on a trackpad? If you click on one of the 
> previously-hidden-but-now-exposed rows, then try to drag it as a separate 
> step, does the scroll happen?
> 
> I’d assume the problem arises because you have a scroll view within a scroll 
> view, and each scroll has installed a pan gesture recognizer. The recognizer 
> may be capturing the visibleRect of the scrolled view, and when you scroll 
> the outer view, there may not be anything to tell the inner view that its 
> visibleRect has changed.
> 
> This is all pretty moot, though. Even if that’s the explanation, I can’t 
> think of anything you can do about it.
> 

___

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: Embedded Collection View Controller scrolling issue

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 16:22 , Doug Hill  wrote:
> 
> The embedded collection view will only scroll if I drag on the area of the 
> collection view that is originally visible.

Can you clarify this a bit? Are you talking about the autoscrolling that 
happens when you drag-select, or scrolling that happens when you use a scroll 
gesture on a trackpad? If you click on one of the 
previously-hidden-but-now-exposed rows, then try to drag it as a separate step, 
does the scroll happen?

I’d assume the problem arises because you have a scroll view within a scroll 
view, and each scroll has installed a pan gesture recognizer. The recognizer 
may be capturing the visibleRect of the scrolled view, and when you scroll the 
outer view, there may not be anything to tell the inner view that its 
visibleRect has changed.

This is all pretty moot, though. Even if that’s the explanation, I can’t think 
of anything you can do about it.

___

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: NSTimer or what?

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 20:04 , Gerriet M. Denkmann  wrote:
> 
> What is the most efficient (energy-wise) way to do this:
> 
> NSTimer (with tolerance)
> NSRunLoop performSelector:target:argument:order:modes:
> NSObject  performSelector:withObject:afterDelay:
> GCD   dispatch_after

I don’t think it really matters, compared to waste of energy that polling for 
an extended period (with a timer) implies. The tolerance isn’t going to help 
you here, because it’s for coalescing things that (say) happen when the display 
wakes or radios turn on or network interfaces activate — things that take 
longer than 0.1 seconds to finish, usually.

___

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: Cursor outside Rect without polling

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 20:17 , Gerriet M. Denkmann  wrote:
> 
> 1. if the cursor is initially NOT in the rect, the app does not get notified:
> Workaround: user moves cursor into the rect (not very good).
> 
> 2. if the app is hidden under some other windows, it also does not get 
> notified.
> Workaround: user removes covering windows of other apps, then moves cursor 
> into the rect (even worse).

Here’s what I use:

[[NSTrackingArea alloc] initWithRect: NSZeroRect 
options: (NSTrackingInVisibleRect | 
NSTrackingCursorUpdate | // maybe you don’t need this
NSTrackingMouseMoved | 
NSTrackingActiveInKeyWindow | // maybe you need NSTrackingActiveAlways
NSTrackingMouseEnteredAndExited | 
NSTrackingEnabledDuringMouseDrag | 
NSTrackingAssumeInside)
owner: self 
userInfo: nil];

1. Note that the documentation for NSTrackingAssumeInside is very misleading, 
and you should generally include this flag. (I just looked at the latest 
documentation, and the description has been rewritten *again*, and it looks 
plain wrong, since it seems to describe the same behavior when the flag is on 
as when it is off.) I just recall that NSTrackingAssumeInside causes tracking 
to fail less often. (There’s a defect in the mechanism that means it’s not 100% 
reliable initially. You may still need an explicit test to find out where the 
cursor is at the time you add the tracking area.)

2. If you need to keep tracking the inside/outside status, then maybe you need 
NSTrackingActiveAlways, to know where it is always, even if you don’t update 
the UI (or whatever) until your app becomes active again.

___

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


Cursor outside Rect without polling

2017-06-19 Thread Gerriet M. Denkmann
macOS.

Some Cocoa app wants to know whether the cursor moved from any point to a point 
outside of some rect.

Currently I use polling (which looks kind of inefficient).

I tried NSTrackingArea, but this does not work:

1. if the cursor is initially NOT in the rect, the app does not get notified:
Workaround: user moves cursor into the rect (not very good).

2. if the app is hidden under some other windows, it also does not get notified.
Workaround: user removes covering windows of other apps, then moves cursor into 
the rect (even worse).

Gerriet.

___

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


NSTimer or what?

2017-06-19 Thread Gerriet M. Denkmann
macOS 11+

Some Cocoa app which has to do:
1. something a few seconds later
2. some other thing repeatedly about every 0.1 second.


What is the most efficient (energy-wise) way to do this:

NSTimer (with tolerance)
NSRunLoop   performSelector:target:argument:order:modes:
NSObjectperformSelector:withObject:afterDelay:
GCD dispatch_after
something else.


Gerriet.

___

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


Embedded Collection View Controller scrolling issue

2017-06-19 Thread Doug Hill
I have a View Controller that has some embedded view controllers in it. One of 
the embedded view controllers is a Collection View Controller. This view 
controller is a grid of values that can be an arbitrary content size (e.g. 
number of cells) but the collection view bounds has fixed size. The collection 
view content can scroll within it's bounds, in addition to the parent scroll 
view scrolling the entire collection view..

Everything seems to work fine except for the scroller-in-a-scroller issue. 
Since the parent view controller can have many embedded child view controllers, 
the parent height can be very big. Then the embedded collection view can also 
scroll it's own content separately. That is, the child collection view width is 
small compared to it's content so that the view will scroll as needed inside 
the parent view as a separate scroll view.

OK, all is good so far except for the following. The embedded collection view 
will only scroll if I drag on the area of the collection view that is 
originally visible. That is, the area of the embedded collection view that is 
visible when first displayed. Let's say rows 1 to 10 are initially visible.
However, if I scroll the parent scroll view vertically to show row 11 of the 
collection view, and then attempt to scroll the embedded scroll view 
horizontally while dragging in row 11, it will only scroll the parent scroll 
view. But if I scroll in the area of the embedded view that was originally 
visible (rows 1 through 10) I can scroll the content of the collection view.

I checked the scroll view content size for both the parent and child scroll 
views and they seem to be correct. I'm looking for ways to debug this. Any 
ideas is appreciated.

Doug Hill
___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Alex Zavatone
I think we’re reading this differently.  But I remembered reading the header 
info from Mac OS in 2009, which I’ll have to look into.



What I pasted from line 153 of UIKit, UIViewController.h, (NOT AppKit 
NSViewController.h) explicitly says that “If you
 invoke this method with a nil nib name, then this class' -loadView method will 
attempt to load a NIB whose
 name is the same as your view controller's class."

I don’t know how much clearer it can get.  Buuut to support your point…

You and I are both pasting from the docs, but we’re probably pasting past each 
other with one on iOS and one on Mac OS.  In any case, we can’t see under the 
hood of UIKit or AppKit.

I’m installing a VM now, so if time permits, it will be interesting to see how 
this fails, back to Xcode 3.x on Mac OS and iOS.

There are two things that I am aware of.  1, on iOS, I’ve never had a problem 
here.  2, never ignore it when the docs say that “this could be trouble.”

Thanks Charles.  This has certainly been interesting.  I appreciate the time 
you put in to show exactly where this could be an issue.

- Alex Zavatone



> On Jun 19, 2017, at 5:37 PM, Charles Srstka  wrote:
> 
>> On Jun 19, 2017, at 4:29 PM, Alex Zavatone  wrote:
>> 
>> From line 153 of UIViewController.h: 
>> 
>>  As a convenience, the default init method will do this for you,
>>  and specify nil for both of this methods arguments.) In the specified NIB, 
>> the File's Owner proxy should
>>  have its class set to your view controller subclass, with the view outlet 
>> connected to the main view. If you
>>  invoke this method with a nil nib name, then this class' -loadView method 
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
>> 
>> The pearl is here:
>> 
>> If you
>>  invoke this method with a nil nib name, then this class' -loadView method 
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
> 
> The documentation begs to differ, though:
> 
> https://developer.apple.com/documentation/appkit/nsviewcontroller/1434405-loadview
> 
>> Prior to OS X v10.10, the loadView() method did not provide well-defined 
>> behavior if the nibName property’s value was nil. In macOS 10.10 and later, 
>> however, you get correct behavior without specifying a nib name as long as 
>> the nib file’s name is the same as that of the view controller. For example, 
>> if you have a view controller subclass called MyViewController and a nib 
>> file with the same name, you can employ the convenient initialization 
>> pattern [[MyViewController alloc] init].
> 
> The AppKit release notes agree:
> 
> https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#10_10ViewController
> 
>> loadView: would previously not have well defined behavior if there was a 
>> "nil" nibName. On 10.10 and later, if nibName is nil NSViewController will 
>> automatically try to load a nib with the same name as the classname. This 
>> allows a convenience of doing [[MyViewController alloc] init] (which has a 
>> nil nibName) and having it automatically load a nib with the name 
>> "MyViewController”.
> 
> The sense I get from these methods is that it might have kinda, sorta, 
> accidentally worked in the past, but it shouldn’t be relied on.
> 
> Reading through those release notes reminded me of *another* caveat I’d 
> forgotten; the functionality only correctly parses Swift class names in 
> *10.11* and higher. Otherwise, it’ll be looking for MyProjectName.Foo.xib 
> instead of Foo.xib like it should. So, if you’re using Swift, better to 
> restrict usage of this feature to El Cap or better.
> 
> Charles
> 

___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread David Duncan

> On Jun 19, 2017, at 3:37 PM, Charles Srstka  wrote:
> 
>> On Jun 19, 2017, at 4:29 PM, Alex Zavatone  wrote:
>> 
>> From line 153 of UIViewController.h: 
>> 
>>  As a convenience, the default init method will do this for you,
>>  and specify nil for both of this methods arguments.) In the specified NIB, 
>> the File's Owner proxy should
>>  have its class set to your view controller subclass, with the view outlet 
>> connected to the main view. If you
>>  invoke this method with a nil nib name, then this class' -loadView method 
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
>> 
>> The pearl is here:
>> 
>> If you
>>  invoke this method with a nil nib name, then this class' -loadView method 
>> will attempt to load a NIB whose
>>  name is the same as your view controller's class.
> 
> The documentation begs to differ, though:

AppKit vs UIKit – your both right for the respective frameworks you are 
speaking to.

> 
> https://developer.apple.com/documentation/appkit/nsviewcontroller/1434405-loadview
> 
>> Prior to OS X v10.10, the loadView() method did not provide well-defined 
>> behavior if the nibName property’s value was nil. In macOS 10.10 and later, 
>> however, you get correct behavior without specifying a nib name as long as 
>> the nib file’s name is the same as that of the view controller. For example, 
>> if you have a view controller subclass called MyViewController and a nib 
>> file with the same name, you can employ the convenient initialization 
>> pattern [[MyViewController alloc] init].
> 
> The AppKit release notes agree:
> 
> https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#10_10ViewController
> 
>> loadView: would previously not have well defined behavior if there was a 
>> "nil" nibName. On 10.10 and later, if nibName is nil NSViewController will 
>> automatically try to load a nib with the same name as the classname. This 
>> allows a convenience of doing [[MyViewController alloc] init] (which has a 
>> nil nibName) and having it automatically load a nib with the name 
>> "MyViewController”.
> 
> The sense I get from these methods is that it might have kinda, sorta, 
> accidentally worked in the past, but it shouldn’t be relied on.
> 
> Reading through those release notes reminded me of *another* caveat I’d 
> forgotten; the functionality only correctly parses Swift class names in 
> *10.11* and higher. Otherwise, it’ll be looking for MyProjectName.Foo.xib 
> instead of Foo.xib like it should. So, if you’re using Swift, better to 
> restrict usage of this feature to El Cap or better.
> 
> Charles
> 
> ___
> 
> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan

___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Charles Srstka
> On Jun 19, 2017, at 4:29 PM, Alex Zavatone  wrote:
> 
> From line 153 of UIViewController.h: 
> 
>   As a convenience, the default init method will do this for you,
>   and specify nil for both of this methods arguments.) In the specified NIB, 
> the File's Owner proxy should
>   have its class set to your view controller subclass, with the view outlet 
> connected to the main view. If you
>   invoke this method with a nil nib name, then this class' -loadView method 
> will attempt to load a NIB whose
>   name is the same as your view controller's class.
> 
> The pearl is here:
> 
> If you
>   invoke this method with a nil nib name, then this class' -loadView method 
> will attempt to load a NIB whose
>   name is the same as your view controller's class.

The documentation begs to differ, though:

https://developer.apple.com/documentation/appkit/nsviewcontroller/1434405-loadview

> Prior to OS X v10.10, the loadView() method did not provide well-defined 
> behavior if the nibName property’s value was nil. In macOS 10.10 and later, 
> however, you get correct behavior without specifying a nib name as long as 
> the nib file’s name is the same as that of the view controller. For example, 
> if you have a view controller subclass called MyViewController and a nib file 
> with the same name, you can employ the convenient initialization pattern 
> [[MyViewController alloc] init].

The AppKit release notes agree:

https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/index.html#10_10ViewController

> loadView: would previously not have well defined behavior if there was a 
> "nil" nibName. On 10.10 and later, if nibName is nil NSViewController will 
> automatically try to load a nib with the same name as the classname. This 
> allows a convenience of doing [[MyViewController alloc] init] (which has a 
> nil nibName) and having it automatically load a nib with the name 
> "MyViewController”.

The sense I get from these methods is that it might have kinda, sorta, 
accidentally worked in the past, but it shouldn’t be relied on.

Reading through those release notes reminded me of *another* caveat I’d 
forgotten; the functionality only correctly parses Swift class names in *10.11* 
and higher. Otherwise, it’ll be looking for MyProjectName.Foo.xib instead of 
Foo.xib like it should. So, if you’re using Swift, better to restrict usage of 
this feature to El Cap or better.

Charles

___

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: Property in class mirrored to user defaults

2017-06-19 Thread Alex Zavatone
As mentioned, there is NSUserDefaults.

I think that there is a better way that is pretty much built in, but one that 
we often ignore.  NSCoding.

This is what it does.
 
Matt Thompson has a nice write up on this here (in Objective-C and Swift), with 
a critical observation at the end of the comparison between Core Data and 
NSCoding/NSKeyedArchiver.

http://nshipster.com/nscoding/


Core Data   NSKeyedArchiver
Persists State  Yes Yes
Pain in the Ass Yes No

Once you set it up, you do this to save the data:

[NSKeyedArchiver archiveRootObject:myRootObject oFile:@"/path/to/archive”];

And you can do this on your singleton’s initialization to populate the object:

[NSKeyedUnarchiver unarchiveObjectWithFile:@"/path/to/archive"];


ALSO, the official patron saint of “Why didn’t Apple give us this?”, Nick 
Lockwood has created really nice AutoCoding category on NSObject that makes 
this automatic, so you don’t have to set it up manually for every property 
within your singleton.


https://github.com/nicklockwood/AutoCoding
 
You’ll also want to pay attention to when you have to change your data format 
too:
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Archiving/Articles/compatibility.html#//apple_ref/doc/uid/20001055-BCICFFGE






> On Jun 12, 2017, at 4:04 AM, Jonathan Taylor  
> wrote:
> 
> Hi all,
> 
> This feels like a very basic question, but one that I have not had any luck 
> searching for (maybe I am using the wrong terms?).
> 
> At the moment I have properties in a (singleton) class that are bound to UI 
> elements. At the moment they have the same automatic values every time the 
> app is launched, although the user can change them while it is running. What 
> I would like is for the user's previous choice to be remembered when the app 
> is next launched. Obviously this would seem to be a job for NSUserDefaults. I 
> am not sure quite what the right way to structure things is, though.
> 
> All the simple examples I have seen bind to NSUserDefaults and then if the 
> program actually wants to know what the value is, it simply accesses the 
> values directly on NSUserDefaults. I would prefer not to do that, though (see 
> below).
> 
> What I ~think~ I would like is to still be able to access the values as 
> properties of my class. That seems to me like the natural way, and it would 
> seem odd to have two categories of value, some accessed through properties on 
> the class, and some accessed some other way via NSUserDefaults. However, if I 
> bind the UI elements to the shared user defaults object, is that not what 
> will happen? Or is there some way that I can "link" my class and the user 
> defaults object, so that the properties are saved in user defaults but I can 
> still access them in a fairly seamless way from my class? I do like the idea 
> of having the properties (and their types) explicitly declared as part of my 
> class, rather than being mysterious objects that only exist in the user 
> defaults.
> 
> Does anyone have any advice on how I can achieve this, or on how I should be 
> thinking about all this differently?
> Thanks
> Jonny
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Alex Zavatone

> On Jun 19, 2017, at 3:25 PM, Charles Srstka  wrote:
> 
>> On Jun 19, 2017, at 2:51 PM, Alex Zavatone > > wrote:
>> 
>> What is EXCELLENT is when you take the storyboard and remove all the top 
>> level views.  Then, create individual XIBs for each scene.  The 
>> viewController.h specifies that “if a view can not be found, an .xib with 
>> the same name of the class file will be looked for and will be loaded if 
>> found.”  I’ve seen this text in the viewController.h since 2009, if I recall 
>> correctly, so it’s not due to change any time soon.
> 
> Keep in mind that according to the documentation, this is only true of macOS 
> 10.10 and higher. So if you are targeting 10.9 or below, you cannot do this 
> (although it’s fairly trivial to write one’s own general NSViewController 
> subclass that does this, as I did for many years before the built-in 
> functionality was introduced).
> 
> Charles
> 

N.  I started doing this back in iOS 5.

I just fired up Xcode 4.2, build 4C199 and took this screenshot:

http://i.imgur.com/Yheac01.png

From line 153 of UIViewController.h: 

  As a convenience, the default init method will do this for you,
  and specify nil for both of this methods arguments.) In the specified NIB, 
the File's Owner proxy should
  have its class set to your view controller subclass, with the view outlet 
connected to the main view. If you
  invoke this method with a nil nib name, then this class' -loadView method 
will attempt to load a NIB whose
  name is the same as your view controller's class.

The pearl is here:

If you
  invoke this method with a nil nib name, then this class' -loadView method 
will attempt to load a NIB whose
  name is the same as your view controller's class.

The thing is that we don’t call loadView, but it is called without a nib name 
when the OS calls it.  This is done and has been done automatically for over a 
decade, by the OS, if I’m not mistaken.

I’m sure we all have work to do, but it’s easy enough for me to open apps I 
created from 2014 and before where we used this in shipping products to prevent 
storyboard merge issues.

And here we go.  2014.  Xcode 5.0.2

View Controller doing nothing special on its init methods + xib right below it.
http://i.imgur.com/Btgc4w5.png

Storyboard serving as a skeleton with the top level view removed from a scene
http://i.imgur.com/Zc2AtJC.png

I just unearthed xcode_3.2.4_and_ios_sdk_4.1.dmg from 2010.  After I get a 
spare VM set up, I’ll see what the viewController.h comments say.  



___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 11:31 , Dave  wrote:
> 
> I think it would be better to move to NIBs now before wasting anymore time 
> trying to get Storyboards to work.

I don’t honestly understand why you think this is going to make anything 
easier. With storyboards, you *are* using NIBs, behind the scenes. Everything 
is architecturally the same as starting from XIB files, except in a couple of 
minor areas (e.g. in code you instantiate view controllers from the storyboard 
instead of creating them directly). Plus, with a storyboard you can wire up 
segues instead of having to figure out how to do the particular transition 
using one of a bewildering array of methods.

Either way, you’re going to have to learn at some point how the view controller 
hierarchy works, which entirely separate from how the view hierarchy works, and 
has nothing much to do with how complex your views are. (That’s what I assumed 
“I only have one fairly complex view controller” meant, since one view 
controller is not a complicated VC hierarchy. Putting that VC in a XIB file 
still gives you the same one-VC hierarchy, and you still are no closer to a 
solution to your problems.)

I know it’s frustrating, and I’m no expert on this, but I think there is an 
“Aha!” moment when you figure out that storyboards are not in fact magic (or 
perhaps, in your current scenario, not in fact out to screw you), and the view 
controller thing just falls into place.

___

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: Help with Storyboard Problem

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 11:24 , Dave  wrote:
> 
> I’ve tried using Segues but can’t get that to work

You haven’t said what “can’t get that to work” means. What do you expect? What 
happens? What does your view controller hierarchy look like.

> so instead of setting myView =
> call:
> [self presentViewController:myGameViewController animated:YES completion: nil]

According to the documentation, this does a *modal* presentation, which doesn’t 
sound like what you want.

If you’re trying to replace your root view controller, you can do that, but not 
via a segue. If you want to a segue, you need to embed your “apparent” root 
view controller inside a container VC that’s really the root, and then you can 
use a segue to replace “apparent” with “new apparent”.


___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Charles Srstka
> On Jun 19, 2017, at 2:51 PM, Alex Zavatone  wrote:
> 
> What is EXCELLENT is when you take the storyboard and remove all the top 
> level views.  Then, create individual XIBs for each scene.  The 
> viewController.h specifies that “if a view can not be found, an .xib with the 
> same name of the class file will be looked for and will be loaded if found.”  
> I’ve seen this text in the viewController.h since 2009, if I recall 
> correctly, so it’s not due to change any time soon.

Keep in mind that according to the documentation, this is only true of macOS 
10.10 and higher. So if you are targeting 10.9 or below, you cannot do this 
(although it’s fairly trivial to write one’s own general NSViewController 
subclass that does this, as I did for many years before the built-in 
functionality was introduced).

Charles

___

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: Converting a Storyboard into separate NIBs.

2017-06-19 Thread Alex Zavatone
Dave, I can help you out with this too.  

What is EXCELLENT is when you take the storyboard and remove all the top level 
views.  Then, create individual XIBs for each scene.  The viewController.h 
specifies that “if a view can not be found, an .xib with the same name of the 
class file will be looked for and will be loaded if found.”  I’ve seen this 
text in the viewController.h since 2009, if I recall correctly, so it’s not due 
to change any time soon.

I’ve got sample files already created that illustrate this concept pretty well.

Why it is nice is that you can use a storyboard as a skeleton, a screen by 
screen information flow and overview for your program and if your team is 
larger than just you there are no storyboard merge conflicts when more than one 
team member is adding parts to it.  

Please harass me offline and I will send this over to DaveLand.  

I hope it helps.  Cheers.

- Alex Zavatone

> On Jun 19, 2017, at 1:31 PM, Dave  wrote:
> 
> Hi All,
> 
> I have an iOS project that I have made the mistake of using storyboards on. 
> At the moment, I only have one fairly complex view controller and I think it 
> would be better to move to NIBs now before wasting anymore time trying to get 
> Storyboards to work. 
> 
> Can anyone tell me if this is an easy process or not? I mean can I just 
> copy+paste from the Storyboard into a NIB file or better still is there a way 
> to export to a NIB?
> 
> All the Best
> Dave
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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: Help with Storyboard Problem

2017-06-19 Thread Alex Zavatone
Dave.  I’ll help you out if you need it on Skype or whatever.

But first, have you embedded your first view controller in a navigation 
controller?  Select your first view controller in the storyboard.  From the 
Editor menu, select “Embed In” and then select “Navigation Controller”.  

If that doesn’t work, email me and I’ll set aside time to help you.

What do you mean, “the documentation is soo poor”?  I’ll send you my course 
that explains this to as if you are an actual human.  Send me an email offline 
and a Skype contact to zavatone.  i’ll be happy to try and remove some of the 
misery by illustrating a simple case of how this works.

Intuitive, it sure isn’t.

Cheers.  Happy Monday.

- Alex Zavatone



> On Jun 19, 2017, at 1:24 PM, Dave  wrote:
> 
> XCode 8.3.3.
> 
> Hi All,
> 
> I’m using storyboards on an iOS project and can’t seem to get it to work.
> 
> I have two view controllers in the “Main.storyboard” file. The fist view 
> controller has one button on it, that when clicked, I want it to go to the 
> other view controller.
> 
> I’ve tried using Segues but can’t get that to work so decided to to it 
> manually.
> 
> I have a method in the first view controller that is hooked to the button as 
> so:
> 
> -(IBAction) startGameAction:(id) theSender
> {
> LTWChaosBoardViewController*  myGameViewController;
> UIView*   
> myView;
> 
> myGameViewController = [self.storyboard 
> instantiateViewControllerWithIdentifier:@"LTWChaosBoardViewController1”];
> myView = myGameViewController.view;
> }
> 
> This returns the correct View Controller but does not actually present it. 
> How do I do this? 
> 
> The documentation is sooo poor that I just can’t find anything that is of 
> help.
> 
> All the Best
> Dave
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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: Help with Storyboard Problem

2017-06-19 Thread Dave
A bit more on this:

I tried it with a NIB as so:

-(IBAction) startGameAction:(id) theSender
{
LTWBoardViewController* myGameViewController;
UIView* myView;

myGameViewController = [[LTWBoardViewController alloc] 
initWithNibName:@"LTWBoardViewController" bundle:nil];

myView = myGameViewController.view;
}

And this doesn’t work either….. Even though it says in the docs that it should 

All I want to do is to call one view controller from another, this used to be 
soo simple!

If anyone could tell me how to present the view controller on the screen I’d be 
really grateful. 

All the Best
Dave

> On 19 Jun 2017, at 20:24, Dave  wrote:
> 
> XCode 8.3.3.
> 
> Hi All,
> 
> I’m using storyboards on an iOS project and can’t seem to get it to work.
> 
> I have two view controllers in the “Main.storyboard” file. The fist view 
> controller has one button on it, that when clicked, I want it to go to the 
> other view controller.
> 
> I’ve tried using Segues but can’t get that to work so decided to to it 
> manually.
> 
> I have a method in the first view controller that is hooked to the button as 
> so:
> 
> -(IBAction) startGameAction:(id) theSender
> {
> LTWChaosBoardViewController*  myGameViewController;
> UIView*   
> myView;
> 
> myGameViewController = [self.storyboard 
> instantiateViewControllerWithIdentifier:@"LTWChaosBoardViewController1”];
> myView = myGameViewController.view;
> }
> 
> This returns the correct View Controller but does not actually present it. 
> How do I do this? 
> 
> The documentation is sooo poor that I just can’t find anything that is of 
> help.
> 
> All the Best
> Dave
> 
> ___
> 
> 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/dave%40looktowindward.com
> 
> This email sent to d...@looktowindward.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: Help with Storyboard Problem

2017-06-19 Thread davelist

> On Jun 19, 2017, at 2:24 PM, Dave  wrote:
> 
> XCode 8.3.3.
> 
> Hi All,
> 
> I’m using storyboards on an iOS project and can’t seem to get it to work.
> 
> I have two view controllers in the “Main.storyboard” file. The fist view 
> controller has one button on it, that when clicked, I want it to go to the 
> other view controller.
> 
> I’ve tried using Segues but can’t get that to work so decided to to it 
> manually.
> 
> I have a method in the first view controller that is hooked to the button as 
> so:
> 
> -(IBAction) startGameAction:(id) theSender
> {
> LTWChaosBoardViewController*  myGameViewController;
> UIView*   
> myView;
> 
> myGameViewController = [self.storyboard 
> instantiateViewControllerWithIdentifier:@"LTWChaosBoardViewController1”];
> myView = myGameViewController.view;
> }
> 
> This returns the correct View Controller but does not actually present it. 
> How do I do this? 
> 
> The documentation is sooo poor that I just can’t find anything that is of 
> help.
> 
> All the Best
> Dave

UIViewController has a method: - (void)presentViewController:(UIViewController 
*)viewControllerToPresent animated:(BOOL)flag completion:(void 
(^)(void))completion;

so instead of setting myView =
call:
[self presentViewController:myGameViewController animated:YES completion: nil]; 
// (typed in Mail and I've been doing mostly Swift development so check my 
syntax)

HTH,
Dave Reed

___

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


Converting a Storyboard into separate NIBs.

2017-06-19 Thread Dave
Hi All,

I have an iOS project that I have made the mistake of using storyboards on. At 
the moment, I only have one fairly complex view controller and I think it would 
be better to move to NIBs now before wasting anymore time trying to get 
Storyboards to work. 

Can anyone tell me if this is an easy process or not? I mean can I just 
copy+paste from the Storyboard into a NIB file or better still is there a way 
to export to a NIB?

All the Best
Dave

___

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


Help with Storyboard Problem

2017-06-19 Thread Dave
XCode 8.3.3.

Hi All,

I’m using storyboards on an iOS project and can’t seem to get it to work.

I have two view controllers in the “Main.storyboard” file. The fist view 
controller has one button on it, that when clicked, I want it to go to the 
other view controller.

I’ve tried using Segues but can’t get that to work so decided to to it manually.

I have a method in the first view controller that is hooked to the button as so:

-(IBAction) startGameAction:(id) theSender
{
LTWChaosBoardViewController*myGameViewController;
UIView* myView;

myGameViewController = [self.storyboard 
instantiateViewControllerWithIdentifier:@"LTWChaosBoardViewController1”];
myView = myGameViewController.view;
}

This returns the correct View Controller but does not actually present it. How 
do I do this? 

The documentation is sooo poor that I just can’t find anything that is of 
help.

All the Best
Dave

___

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: Annual codesign pain point

2017-06-19 Thread Alex Zavatone
Well, I guess that didn't come through.

I was wondering if you still get that certificate mismatch now that the image 
is corrected.


Sent from my iPhone

> On Jun 19, 2017, at 8:29 AM, Alex Zavatone  wrote:
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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: Annual codesign pain point

2017-06-19 Thread Alex Zavatone

___

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