Would anyone agree me that ARC introduces more rules and considerations than 
previously existed with manual reference counting?


On Sep 8, 2013, at 12:00 PM, cocoa-dev-requ...@lists.apple.com wrote:

> Send Cocoa-dev mailing list submissions to
>       cocoa-dev@lists.apple.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
>       cocoa-dev-requ...@lists.apple.com
> 
> You can reach the person managing the list at
>       cocoa-dev-ow...@lists.apple.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
> 
> 
> Today's Topics:
> 
>   1. Evil setFrame: (Gerriet M. Denkmann)
>   2. Re: Evil setFrame: (Kyle Sluder)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 08 Sep 2013 11:36:08 +0700
> From: "Gerriet M. Denkmann" <gerr...@mdenkmann.de>
> To: cocoa-dev@lists.apple.com
> Subject: Evil setFrame:
> Message-ID: <93387169-15d1-42a9-a1c0-fc516ffeb...@mdenkmann.de>
> Content-Type: text/plain; charset=utf-8
> 
> I try to show a nib (which uses autolayout and which contains among other 
> things a NewView inside an NSClipView inside an NSScrollView ) like this:
> 
> if ( self.neuWindowController == nil )        
> {
>       //      NewWindowController is subclass of NSWindowController
>       self.neuWindowController  =     [ [NewWindowController alloc]   
> initWithWindowNibName:  @"SomeNib" 
>                                                                               
>                                                 eventsList:                   
>   someArray 
>                                                               ];
> };
> 
> [ self.neuWindowController showWindow: nil ];
> 
> The last line triggers in my NewView:
> 
> -[NewView resizeWithOldSuperviewSize:] NewView 0x101982430 bounds {{0, 0}, 
> {437, 252}}
> -[NewView resizeWithOldSuperviewSize:] NewView 0x101982430 frame  {{0, 0}, 
> {437, 252}}
> -[NewView resizeWithOldSuperviewSize:] NSClipView 0x10197b8e0 bounds {{0, 0}, 
> {398, 94}}
> -[NewView resizeWithOldSuperviewSize:] will call super with oldBoundsSize 
> {437, 254}
>       -[NewView setFrame:] will {{0, 0}, {0, 0}}      ← why is super doing 
> this to me ??
> -[NewView resizeWithOldSuperviewSize:] got frame {{0, 0}, {0, 0}}
> 
> and from here on nothing works (not too surprising with such a small frame).
> 
> Something must be terrible wrong in my setup of NewView, but what?
> 
> Gerriet.
> 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Sat, 07 Sep 2013 22:04:31 -0700
> From: Kyle Sluder <k...@ksluder.com>
> To: "Gerriet M. Denkmann" <gerr...@mdenkmann.de>,
>       cocoa-dev@lists.apple.com
> Subject: Re: Evil setFrame:
> Message-ID:
>       <1378616671.3574.19245285.59d48...@webmail.messagingengine.com>
> Content-Type: text/plain; charset=utf-8
> 
> On Sat, Sep 7, 2013, at 09:36 PM, Gerriet M. Denkmann wrote:
>> I try to show a nib (which uses autolayout and which contains among other
>> things a NewView inside an NSClipView inside an NSScrollView ) like this:
>> 
>> if ( self.neuWindowController == nil )  
>> {
>>      //      NewWindowController is subclass of NSWindowController
>>      self.neuWindowController  =     [ [NewWindowController alloc]   
>> initWithWindowNibName:  @"SomeNib" 
>>                                                                              
>>                                                 eventsList:                  
>>    someArray 
>>                                                              ];
>> };
>> 
>> [ self.neuWindowController showWindow: nil ];
>> 
>> The last line triggers in my NewView:
>> 
>> -[NewView resizeWithOldSuperviewSize:] NewView 0x101982430 bounds {{0,
>> 0}, {437, 252}}
>> -[NewView resizeWithOldSuperviewSize:] NewView 0x101982430 frame  {{0,
>> 0}, {437, 252}}
>> -[NewView resizeWithOldSuperviewSize:] NSClipView 0x10197b8e0 bounds {{0,
>> 0}, {398, 94}}
>> -[NewView resizeWithOldSuperviewSize:] will call super with oldBoundsSize
>> {437, 254}
>>      -[NewView setFrame:] will {{0, 0}, {0, 0}}      ← why is super doing 
>> this to me ??
>> -[NewView resizeWithOldSuperviewSize:] got frame {{0, 0}, {0, 0}}
>> 
>> and from here on nothing works (not too surprising with such a small
>> frame).
>> 
>> Something must be terrible wrong in my setup of NewView, but what?
> 
> NewView lacks sufficient constraints to specify its size or position, to
> it is being resized to zero.
> 
> I'm guessing NewView is the direct subview of the clip view? If so, you
> _MUST NOT_ change its translatesAutoresizingMaskIntoConstraints
> property, and you _MUST NOT_ try to control its size or position with
> constraints.
> 
> I learned that the hard way over the course of several months. It's
> quite a pain in the ass, because a lot of constraints you'll naturally
> want to draw will be just as likely to affect the size of the scroll
> view's documentView as they are to use the size of the documentView to
> affect the subviews.
> 
> In our case, we really want to use auto layout to determine the size of
> the documentView. But we don't create any constraints between the
> documentVIew and any of its subviews. Instead, we add a hidden view as a
> subview of the documentVIew, and draw all our constraints relative to
> THAT view. Let's call that the adaptor view. The adaptor view has two
> constraints that pin its origin to the documentView's origin, but
> crucially there are no width or height dependencies between the views.
> 
> We then register as observes of the adaptor view's
> NSViewFrameDidChangeNotification and update the size of the documentView
> to match. The scroll view then dutifully updates its scrollers.
> 
> It's unfortunate that we have to jump through all these hoops. Apple
> could implement something similar themselves to make working with
> constraints inside an NSScrollView much easier—as easy as it is to use
> constraints with UIScrollView.
> 
> --Kyle Sluder
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> 
> Cocoa-dev mailing list      (Cocoa-dev@lists.apple.com)
> 
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
> 
> https://lists.apple.com/mailman/listinfo/cocoa-dev
> 
> 
> End of Cocoa-dev Digest, Vol 10, Issue 564
> ******************************************


_______________________________________________

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

Reply via email to