Re: Staggering new windows

2016-03-08 Thread Daryle Walker
On Mar 3, 2016, at 10:56 PM, Seth Willits  wrote:
> 
>> On Mar 3, 2016, at 2:46 PM, Daryle Walker  wrote:
>> 
>> This new Xcode project (with storyboards) makes new windows at the same 
>> coordinates, on top of each other. Just the ever increasing shadow gives 
>> that behavior away. Is there a way to (automatically) get that old Mac 
>> behavior of staggered windows? I think it was 20 pixels down and right.
> 
> 
> Window Cascading:
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/WinPanel/Tasks/SizingPlacingWindows.html

Although the docs say it defaults to TRUE, it doesn’t work like that in 
practice.

On some random Mac programming page, I saw code explicitly setting cascading to 
TRUE. I looked at that and wondered if I can do better. Since the setting looks 
like a property, I added “shouldCascadeWindows” to the User-Defined Runtime 
Attributes section of the window controller’s settings in Interface Builder. I 
set the attribute to Boolean and its value to TRUE, and sure enough it worked!

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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: Staggering new windows

2016-03-08 Thread dangerwillrobinsondanger

> On Mar 8, 2016, at 6:36 PM, Daryle Walker  wrote:
> 
> On some random Mac programming page, I saw code explicitly setting cascading 
> to TRUE. I looked at that and wondered if I can do better. Since the setting 
> looks like a property, I added “shouldCascadeWindows” to the User-Defined 
> Runtime Attributes section of the window controller’s settings in Interface 
> Builder. I set the attribute to Boolean and its value to TRUE, and sure 
> enough it worked!
Does it work without using StoryBoards?
___

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: State Restoration thinks all my windows closes prior to quit

2016-03-08 Thread Daryle Walker
On Mar 7, 2016, at 3:40 PM, Quincey Morris 
 wrote:
> 
> On Mar 5, 2016, at 01:36 , Daryle Walker  > wrote:
>> 
>> The “applicationOpenUntitledFile:” and “newDocument:” methods call this 
>> method.
> 
> On Mar 7, 2016, at 12:30 , Daryle Walker  > wrote:
>> 
>> I haven’t set any restoration class. But that wasn’t a problem before; 
>> Apple’s default code worked just fine. I don’t know what I changed to break 
>> it.
> 
> It sounds like this is a document-based app, even if it isn’t currently a 
> NSDocument-based app. Apple has no “default code” for document-based apps 
> that don’t use NSDocument. So, my guess is that you were previously using 
> NSDocument and now you’re not.

Nope, it was made from the non-Document, non-CoreData, pro-Storyboard app 
template.

> If that’s not the case, do you still have the project that “worked” until the 
> changes broke it?

No. I was going to commit it after this (if it worked). But I think I’m going 
to trash it and start over with the pro-Storyboard, pro-Document app template. 
(I am thinking of using Core Data, but I’m not going add it right now. One, I’m 
still not sure I’m going to use it. Two, I may not use it like 
NSPersistentDocument does, especially since that subclass doesn’t support some 
behaviors.)

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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

UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Jens Alfke
I’m animating a UITableView in response to its backing data changing. I’ve 
gotten it working with row insertion, deletion and reloads, but now I’m trying 
to add row movement and it seems like I’ve blown the little view’s mind. Does 
anyone have experience at combining -moveRowAtIndexPath: with the other 
operations inside a beginUpdates…endUpdates block?

Here’s an example of what’s not working. Assume the backing store changes from 
[A, B, C, D, E, F] to [A, E, B, C, G, F]. This can be expressed as “move row 4 
to index 1” and “change (the old) row 3 from 'D' to ‘G’”. So I call:
[table beginUpdates];
[table moveRowAtIndexPath: 4 toIndexPath: 1];
[table reloadRowsAtIndexPaths: @[@3]];
[table endUpdates];
(For simplicity I’m showing the parameters as integers instead of NSIndexPaths.)

This doesn’t work; what ends up displayed (vertically) is [A, E, B, C, C, F]. 
Row 4 is C when it should be G. After the -endUpdates call, my dataSource is 
asked to create a cell at row 3, which it populates with a C. So it looks like 
the table view is processing the reload before the move, but without taking 
into account the reordering. So it asks my data source for row 3 when it should 
ask for row 4.

So then I tried changing using the new row number (4) in 
-reloadRowsAtIndexPaths:. This causes an assertion failure down within 
-endUpdates — "attempt to perform a delete and a move from the same index path”.

The docs have no advice; the Table View Programming Guide says nothing about 
-moveRowAtIndexPath:toIndexPath:. The API doc for that method says "You can 
combine row-move operations with row-insertion and row-deletion operations 
within a beginUpdates–endUpdates block to have all changes occur together as a 
single animation” but doesn’t discuss the nuances of row numbering or ordering 
of operations.

Anyone got a clue?

—Jens

PS: iOS 9.2 (only simulator so far)
___

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: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Luke Hiesterman
If you’re getting asked to create a row at index 3 from that code snippet, then 
that looks like a UIKit bug. I’d advise filing it at bugreport.apple.com 
including a sample app showing that behavior.

Luke

> On Mar 8, 2016, at 11:26 AM, Jens Alfke  wrote:
> 
> I’m animating a UITableView in response to its backing data changing. I’ve 
> gotten it working with row insertion, deletion and reloads, but now I’m 
> trying to add row movement and it seems like I’ve blown the little view’s 
> mind. Does anyone have experience at combining -moveRowAtIndexPath: with the 
> other operations inside a beginUpdates…endUpdates block?
> 
> Here’s an example of what’s not working. Assume the backing store changes 
> from [A, B, C, D, E, F] to [A, E, B, C, G, F]. This can be expressed as “move 
> row 4 to index 1” and “change (the old) row 3 from 'D' to ‘G’”. So I call:
>   [table beginUpdates];
>   [table moveRowAtIndexPath: 4 toIndexPath: 1];
>   [table reloadRowsAtIndexPaths: @[@3]];
>   [table endUpdates];
> (For simplicity I’m showing the parameters as integers instead of 
> NSIndexPaths.)
> 
> This doesn’t work; what ends up displayed (vertically) is [A, E, B, C, C, F]. 
> Row 4 is C when it should be G. After the -endUpdates call, my dataSource is 
> asked to create a cell at row 3, which it populates with a C. So it looks 
> like the table view is processing the reload before the move, but without 
> taking into account the reordering. So it asks my data source for row 3 when 
> it should ask for row 4.
> 
> So then I tried changing using the new row number (4) in 
> -reloadRowsAtIndexPaths:. This causes an assertion failure down within 
> -endUpdates — "attempt to perform a delete and a move from the same index 
> path”.
> 
> The docs have no advice; the Table View Programming Guide says nothing about 
> -moveRowAtIndexPath:toIndexPath:. The API doc for that method says "You can 
> combine row-move operations with row-insertion and row-deletion operations 
> within a beginUpdates–endUpdates block to have all changes occur together as 
> a single animation” but doesn’t discuss the nuances of row numbering or 
> ordering of operations.
> 
> Anyone got a clue?
> 
> —Jens
> 
> PS: iOS 9.2 (only simulator so far)
> ___
> 
> 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/luketheh%40apple.com
> 
> This email sent to luket...@apple.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: Returning a string value from a c function to a Objective-C class method. Is there an approved approach?

2016-03-08 Thread Alex Zavatone
I just discovered that using KVO to get this returned value that is stored as a 
copied property within the class that is C & Obj-C is a really bad idea.

When I access the data through KVO from the VC that created the call to 
instantiate the lib that returns the C to Obj-C value, it's no problem, but 
moving the observing into a separate class results in a sigabrt when the 
observed value changes.

So, I'm assuming that KVO is out of the picture if I am to actually use the 
value that I am returning from C to Objective-C.

I'm browsing the Dubrovnik classes now to see the it handles returning the data 
now and am thinking of using another Obj-C object to register itself to have 
the data I care about sent to it.

Yeah, it's getting complex, that's for sure.



On Mar 4, 2016, at 7:06 PM, John McCall wrote:

> 
>> On Mar 4, 2016, at 4:03 PM, Greg Parker  wrote:
>> 
>> 
>>> On Mar 4, 2016, at 2:24 PM, Jonathan Mitchell  wrote:
>>> 
>>> Hi Alex
>>> 
>>> Not sure if this will help at all as I am not 100% sure what you are doing.
>>> In my case, using Mono, I needed to track events being raised in the Mono C 
>>> runtime back into Obj-C space.
>>> You need some method of defining a call back function in the target C Api - 
>>> without that thinks would look rather bleak.
>>> 
>>> Basically the C Mono runtime is configured to a call static C function in 
>>> an Obj C .m file in response to a C# managed event firing.
>>> The static then calls a static method on an Obj-C class.
>>> This Obj-C static uses collections to track registered events and invokes 
>>> performSelector: on a registered Obj-C target.
>>> See here:
>>> https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBManagedEvent.m
>>> 
>>> One of the arguments based in as part of the event callback is a pointer 
>>> that is used as a a key to retrieve the target NSObject.
>>> This is complicated by the fact that the incoming pointer represents a 
>>> moveable memory location so there is some extra indirection too.
>>> https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBPrimaryInstanceCache.m
>>> 
>>> This can get a bit complex but its all doable.
>> 
>> Block objects can help. clang supports block objects in plain C code 
>> (-fblocks, I think).
> 
> They're just enabled by default on our platform in all language modes.
> 
> John.
> 
>> Your Objective-C code can create a block object that performs the callback 
>> and pass it to the C code to store and call. The block object would capture 
>> the target NSObject so you don't need the dictionary of callback targets.
>> 
>> 
>> -- 
>> Greg Parker gpar...@apple.com Runtime Wrangler
>> 
>> 
>> 
>> ___
>> 
>> 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/rjmccall%40apple.com
>> 
>> This email sent to rjmcc...@apple.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/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: Returning a string value from a c function to a Objective-C class method. Is there an approved approach?

2016-03-08 Thread Jonathan Mitchell
Alex

> On 8 Mar 2016, at 20:59, Alex Zavatone  wrote:
> 
> I'm browsing the Dubrovnik classes now to see the it handles returning the 
> data now and am thinking of using another Obj-C object to register itself to 
> have the data I care about sent to it.

KVO is very particular about the occurrence and sequencing of the 
willChangeValueForKey: and didChangeValueForKey: methods. Get it right and joy 
Reigns. Get it wrong and well…

It can tolerate some missing calls on the end component of a key path but a 
failure higher up a key path chain is usually fatal. Of course there are 
potential memory issues too. The objects in an observed key path need to stick 
around while the observation is live. 

In Dubrovnik I translate the managed INotifyPropertyChanging and 
INotifyPropertyChanged interface events into their KVO equivalents. I 
incorporated a simple tracking mechanism that fired out warnings if an anomaly 
in the KVO xxxChangeValueForKey: sequencing occurred.

It took a bit of time to get the kinks out of it all but in the end I have a 
system that works reliably and enables me to bind many hundreds of NSControl 
instances to properties of .Net managed classes.

So the KVO route may not be dead, just wounded. In my case to get things sweet 
I had to disable automatic KVO notifications. For regular Cocoa classes auto 
KVO is the way to go but if you need more precise control maybe not.

J

> 
> Yeah, it's getting complex, that's for sure.
> 
> 
> 
> On Mar 4, 2016, at 7:06 PM, John McCall wrote:
> 
>> 
>>> On Mar 4, 2016, at 4:03 PM, Greg Parker  wrote:
>>> 
>>> 
 On Mar 4, 2016, at 2:24 PM, Jonathan Mitchell  wrote:
 
 Hi Alex
 
 Not sure if this will help at all as I am not 100% sure what you are doing.
 In my case, using Mono, I needed to track events being raised in the Mono 
 C runtime back into Obj-C space.
 You need some method of defining a call back function in the target C Api 
 - without that thinks would look rather bleak.
 
 Basically the C Mono runtime is configured to a call static C function in 
 an Obj C .m file in response to a C# managed event firing.
 The static then calls a static method on an Obj-C class.
 This Obj-C static uses collections to track registered events and invokes 
 performSelector: on a registered Obj-C target.
 See here:
 https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBManagedEvent.m
 
 One of the arguments based in as part of the event callback is a pointer 
 that is used as a a key to retrieve the target NSObject.
 This is complicated by the fact that the incoming pointer represents a 
 moveable memory location so there is some extra indirection too.
 https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBPrimaryInstanceCache.m
 
 This can get a bit complex but its all doable.
>>> 
>>> Block objects can help. clang supports block objects in plain C code 
>>> (-fblocks, I think).
>> 
>> They're just enabled by default on our platform in all language modes.
>> 
>> John.
>> 
>>> Your Objective-C code can create a block object that performs the callback 
>>> and pass it to the C code to store and call. The block object would capture 
>>> the target NSObject so you don't need the dictionary of callback targets.
>>> 
>>> 
>>> -- 
>>> Greg Parker gpar...@apple.com Runtime Wrangler
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> 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/rjmccall%40apple.com
>>> 
>>> This email sent to rjmcc...@apple.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/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/lists%40mugginsoft.com
> 
> This email sent to li...@mugginsoft.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/U

Re: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Jens Alfke

> On Mar 8, 2016, at 11:58 AM, Luke Hiesterman  wrote:
> 
> If you’re getting asked to create a row at index 3 from that code snippet, 
> then that looks like a UIKit bug. I’d advise filing it at bugreport.apple.com 
>  including a sample app showing that behavior.

Will do. I have a commit from while it was in that state, and this is a small 
test app.

I was able to work around the problem by moving the reloadRows call to after 
-endUpdates. Of course I had to modify the row numbers to the 
post-insert/delete/move values. It even seems to merge the animations together 
seamlessly.

—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: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Luke Hiesterman
Great. That sounds like the appropriate work-around.

Luke

On Mar 8, 2016, at 1:33 PM, Jens Alfke 
mailto:j...@mooseyard.com>> wrote:

I was able to work around the problem by moving the reloadRows call to after 
-endUpdates. Of course I had to modify the row numbers to the 
post-insert/delete/move values. It even seems to merge the animations together 
seamlessly.

___

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: Returning a string value from a c function to a Objective-C class method. Is there an approved approach?

2016-03-08 Thread Alex Zavatone
Super lovely code Jonathan.  My feeble brain ended up seeing if a delegate 
pattern would resolve this issue and it did.

The trick I am trying to achieve is simply "get the data out of the C class, 
the C/Obj-C glue and dump it into a more friendly structure to expose the data.

Having the data container register a weak reference with the C/Obj-C glue class 
and then letting the data sit there and be observed by a view controller gets 
me where I need to be now.

Ahh yes, hard mode is hard.

Thanks again.  



On Mar 8, 2016, at 4:16 PM, Jonathan Mitchell wrote:

> Alex
> 
>> On 8 Mar 2016, at 20:59, Alex Zavatone  wrote:
>> 
>> I'm browsing the Dubrovnik classes now to see the it handles returning the 
>> data now and am thinking of using another Obj-C object to register itself to 
>> have the data I care about sent to it.
> 
> KVO is very particular about the occurrence and sequencing of the 
> willChangeValueForKey: and didChangeValueForKey: methods. Get it right and 
> joy Reigns. Get it wrong and well…
> 
> It can tolerate some missing calls on the end component of a key path but a 
> failure higher up a key path chain is usually fatal. Of course there are 
> potential memory issues too. The objects in an observed key path need to 
> stick around while the observation is live. 
> 
> In Dubrovnik I translate the managed INotifyPropertyChanging and 
> INotifyPropertyChanged interface events into their KVO equivalents. I 
> incorporated a simple tracking mechanism that fired out warnings if an 
> anomaly in the KVO xxxChangeValueForKey: sequencing occurred.
> 
> It took a bit of time to get the kinks out of it all but in the end I have a 
> system that works reliably and enables me to bind many hundreds of NSControl 
> instances to properties of .Net managed classes.
> 
> So the KVO route may not be dead, just wounded. In my case to get things 
> sweet I had to disable automatic KVO notifications. For regular Cocoa classes 
> auto KVO is the way to go but if you need more precise control maybe not.
> 
> J
> 
>> 
>> Yeah, it's getting complex, that's for sure.
>> 
>> 
>> 
>> On Mar 4, 2016, at 7:06 PM, John McCall wrote:
>> 
>>> 
 On Mar 4, 2016, at 4:03 PM, Greg Parker  wrote:
 
 
> On Mar 4, 2016, at 2:24 PM, Jonathan Mitchell  
> wrote:
> 
> Hi Alex
> 
> Not sure if this will help at all as I am not 100% sure what you are 
> doing.
> In my case, using Mono, I needed to track events being raised in the Mono 
> C runtime back into Obj-C space.
> You need some method of defining a call back function in the target C Api 
> - without that thinks would look rather bleak.
> 
> Basically the C Mono runtime is configured to a call static C function in 
> an Obj C .m file in response to a C# managed event firing.
> The static then calls a static method on an Obj-C class.
> This Obj-C static uses collections to track registered events and invokes 
> performSelector: on a registered Obj-C target.
> See here:
> https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBManagedEvent.m
> 
> One of the arguments based in as part of the event callback is a pointer 
> that is used as a a key to retrieve the target NSObject.
> This is complicated by the fact that the incoming pointer represents a 
> moveable memory location so there is some extra indirection too.
> https://github.com/ThesaurusSoftware/Dubrovnik/blob/master/Framework/XCode/Representations/DBPrimaryInstanceCache.m
> 
> This can get a bit complex but its all doable.
 
 Block objects can help. clang supports block objects in plain C code 
 (-fblocks, I think).
>>> 
>>> They're just enabled by default on our platform in all language modes.
>>> 
>>> John.
>>> 
 Your Objective-C code can create a block object that performs the callback 
 and pass it to the C code to store and call. The block object would 
 capture the target NSObject so you don't need the dictionary of callback 
 targets.
 
 
 -- 
 Greg Parker gpar...@apple.com Runtime Wrangler
 
 
 
 ___
 
 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/rjmccall%40apple.com
 
 This email sent to rjmcc...@apple.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-de

NSSplitViewController and loading of NSSplitViewItems

2016-03-08 Thread Dragan Milić
As it becomes common for my recent posts, since the issue is not easy to 
explain in words, I’ve attached a very simple project demonstrating it.

It’s ongoing troubles with NSSplitViews, this time specifically with 
NSSplitViewController. A sentence from documentation says:

“A split view controller employs lazy loading of its views. For example, adding 
a collapsed split view item as a new child does not load the associated view 
until it is revealed.”

I can get this to work (in both code and IB) only when setting an instance of 
NSSplitViewController as a contentViewController of a window. But I can’t get 
NSSplitViewController to load NSSplitViewItems otherwise.

In the attached project there are two split view controllers; one is set as the 
content view controller of a window and it properly loads its split view items, 
one created with instance of custom subclass named LeftViewController and the 
other with an instance of another subclass named RightViewController. However, 
the view property of the RightViewController contains a subview, in which I try 
to add split view controlled by another split view controller. I do it in 
RightViewController’s -viewDidLoad  method and the code looks like this:


- (void)viewDidLoad
{
NSLog(@"-[%@ viewDidLoad]", self);

[self setSplitViewController:[[NSSplitViewController alloc] 
initWithNibName:nil bundle:nil]];

NSSplitView *splitView = [[self splitViewController] splitView];
[[self containerView] addSubview:splitView];

[NSLayoutConstraint activateConstraints:[NSLayoutConstraint 
constraintsWithVisualFormat:@"|-0-[splitView]-0-|" options:0 metrics:nil 
views:NSDictionaryOfVariableBindings(splitView)]];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint 
constraintsWithVisualFormat:@"V:|-0-[splitView]-0-|" options:0 metrics:nil 
views:NSDictionaryOfVariableBindings(splitView)]];

NSViewController *viewController = [[RightLeftViewController alloc] 
initWithNibName:nil bundle:nil];
[self addChildViewController:viewController];

NSSplitViewItem *splitViewItem = [NSSplitViewItem 
splitViewItemWithViewController:viewController];
[[self splitViewController] addSplitViewItem:splitViewItem];

viewController = [[RightRightViewController alloc] initWithNibName:nil 
bundle:nil];
[self addChildViewController:viewController];

splitViewItem = [NSSplitViewItem 
splitViewItemWithViewController:viewController];
[[self splitViewController] addSplitViewItem:splitViewItem];
}


However, even though that inner split view is added into the split view 
hierarchy, its controlling split view controller doesn’t load added split view 
items (created with instances of yet another two subclasses 
RightLeftViewController and RightRightViewController). Those two view 
controllers (RightLeft and RightRight) never reach their respective 
-viewDidLoad methods. Adding “inner” view controllers as “outer” view 
controller children doesn’t make any difference.

It’s all in the project and it’s pretty simple. You can download it at 
https://www.dropbox.com/s/8w0k2of88n1ksvw/SplitViewControllerTest.zip?dl=0

I’d appreciate any help and explanation why this doesn’t work. Thanks in 
advance.

-- Dragan
___

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: NSSplitViewController and loading of NSSplitViewItems

2016-03-08 Thread Dragan Milić
On sre 09.03.2016., at 01.49, Dragan Milić wrote:

> As it becomes common for my recent posts, since the issue is not easy to 
> explain in words, I’ve attached a very simple project demonstrating it.
> 
> It’s ongoing troubles with NSSplitViews, this time specifically with 
> NSSplitViewController. A sentence from documentation says:
> 
> “A split view controller employs lazy loading of its views. For example, 
> adding a collapsed split view item as a new child does not load the 
> associated view until it is revealed.”
> 
> I can get this to work (in both code and IB) only when setting an instance of 
> NSSplitViewController as a contentViewController of a window. But I can’t get 
> NSSplitViewController to load NSSplitViewItems otherwise.

Okay, I’ve just figured it out. It’s rather simple, but kind of stupid. The 
problem is that the “”inner” split view controller wasn’t being loaded at all. 
In order to load it, one has to access not its “splitView” property, but its 
(from NSViewController superclass inherited) “view” property which is not very 
useful in case of split view controller.

-- Dragan
___

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

UICollectionViewCells flashing on reload

2016-03-08 Thread Rick Mann
I have a UICollectionView with cells that have an image and some UILabels.

The user can sort the list. When the sort button is tapped, I sort the array, 
then call self.collectionView?.reloadData().

Everything reloads fine, but I see some of the text labels flash the content of 
the previous data before updating to the correct value. That is, it seems like 
the cell is reused in the new location, but the rendered UILabel showed the old 
content, then update to show the new. I'm only calling reloadData() once.

I set the data for each cell in 
collectionView(collectionView:cellForItemAtIndexPath:). Should I set it instead 
in willDisplayCell?

-- 
Rick Mann
rm...@latencyzero.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

Enable to edit rounded corners / borders in Storyboard

2016-03-08 Thread 森田秀幸
Hello,

I created a Interface Builder / Storyboard extension library.
I think that this feature is very useful.

https://github.com/recruit-mtl/EXTView/

Don't you think good that it become the standard feature?

---
MORITA Hideyuki
___

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: UICollectionViewCells flashing on reload

2016-03-08 Thread Rick Mann
Augh, nevermind. Buried deep inside there was a dispatch_async() call.

> On Mar 8, 2016, at 17:31 , Rick Mann  wrote:
> 
> I have a UICollectionView with cells that have an image and some UILabels.
> 
> The user can sort the list. When the sort button is tapped, I sort the array, 
> then call self.collectionView?.reloadData().
> 
> Everything reloads fine, but I see some of the text labels flash the content 
> of the previous data before updating to the correct value. That is, it seems 
> like the cell is reused in the new location, but the rendered UILabel showed 
> the old content, then update to show the new. I'm only calling reloadData() 
> once.
> 
> I set the data for each cell in 
> collectionView(collectionView:cellForItemAtIndexPath:). Should I set it 
> instead in willDisplayCell?
> 
> -- 
> Rick Mann
> rm...@latencyzero.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/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


-- 
Rick Mann
rm...@latencyzero.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

Installing MDM profile via Safari View Controller

2016-03-08 Thread Arjun SM
Hi all,

I have a requirement to install an MDM profile with-in the App for which I
was trying to use Safari View Controller.
But in the POC i tried, Safari VC fails to installs the Profiles. No error
logs are printed on console as well to understand what failed.

The same works perfectly fine when i open the URL in Safari.app

I googled around to find if any one has done an in-App MDM profile
installation using Safari View Controller but nothing turned up in search
results as well.

I read that only Safari.app and Mail.app can open and install
.mobileconfig. Does this mean Safari VC cannot be used for installing MDM
profile ?

Thanks in advance for any help provided.

__Arjun
___

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