Re: presentingViewController docs patently false
Re: presentingViewController docs patently false
- Subject: Re: presentingViewController docs patently false
- From: Matt Neuburg <email@hidden>
- Date: Thu, 22 Dec 2011 08:59:29 -0800
On Mon, 19 Dec 2011 15:55:49 -0800, Matt Neuburg <email@hidden> said:
>The docs say:
>
>> @property(nonatomic, readonly) UIViewController *presentingViewController
>> Discussion
>> The default implementation of this property walks up the view hierarchy, starting from this view controller. The first view controller it finds that received the presentViewController:animated:completion: method, or that has its definesPresentationContext property set to YES is returned as the value of the property. It keeps walking up the hierarchy until it finds a value to return or it gets to the root view controller.
>
>Oh, yeah? Watch this:
>
> self.definesPresentationContext = YES;
> self.parentViewController.definesPresentationContext = YES;
> NSLog(@"%i %i", self.definesPresentationContext,
> self.parentViewController.definesPresentationContext);
> // 1 1
> NSLog(@"%@", self.presentingViewController);
> // null
>
>So both self and its parent do in fact have their definesPresentationContext property set to YES, and yet neither is being returned as the value of the property. I rest my case. Maybe the docs are talking here about some very specific situation where what's claimed is correct, but then they should say what that situation is. I've been looking for it all day and haven't found it...
Okay, I did eventually find the situation in which the docs are correct. It only took me two days to figure it out.
But it is up to the docs to state that situation! This really does carry the notion of coy and allusive (and wrong) to its limit. This is not at all the way docs should be.
However, at least my book will be more correct and helpful than the docs, so I suppose I shouldn't complain. m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden