presentingViewController docs patently false

  • 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... m.

    --
    matt neuburg, phd = <matt...>, http://www.apeth.net/matt/
    pantes anthropoi tou eidenai oregontai phusei
    Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
    Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
    RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
    TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
  • On Mon, Dec 19, 2011 at 3:55 PM, Matt Neuburg <matt...> wrote:
    > 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... m.

    I trust you've filed a Radar?

    And you might find this article relevant:
    http://toxicsoftware.com/uistoryboard-issues/

    I've already given up on storyboards. They're not done yet.

    --Kyle Sluder
  • On Dec 19, 2011, at 4:05 PM, Kyle Sluder wrote:

    > On Mon, Dec 19, 2011 at 3:55 PM, Matt Neuburg <matt...> wrote:
    >> 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... m.
    >
    > I trust you've filed a Radar?

    Well, that's another thing - I haven't been able to summon the bugreporter Web page in days.

    > And you might find this article relevant:
    > http://toxicsoftware.com/uistoryboard-issues/
    >
    > I've already given up on storyboards. They're not done yet.

    And they've been oversold. Thanks for the ref to that article - it comes at just the right moment. m.
  • On 19 Dec 2011, at 8:04 PM, Matt Neuburg wrote:

    > Well, that's another thing - I haven't been able to summon the bugreporter Web page in days.

    bugreport.apple.com? I filed yesterday morning (12/19, CST).

    — F
  • On Dec 20, 2011, at 6:58 AM, Fritz Anderson <fritza...> wrote:

    > On 19 Dec 2011, at 8:04 PM, Matt Neuburg wrote:
    >
    >> Well, that's another thing - I haven't been able to summon the bugreporter Web page in days.
    >
    > bugreport.apple.com? I filed yesterday morning (12/19, CST).

    According to Twitter, it was down for scheduled maintenance for much of yesterday.

    --Kyle Sluder
  • On Mon, 19 Dec 2011 15:55:49 -0800, Matt Neuburg <matt...> 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 = <matt...>, <http://www.apeth.net/matt/>
    A fool + a tool + an autorelease pool = cool!
    Programming iOS 4!
    On Dec 22, 2011, at 8:59 AM, Matt Neuburg <matt...> wrote:

    > 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.

    Then please file a bug! The documentation authors can't know about and document every bug in the implementation. Often times I believe they work from the specification in order to have the docs ready for release.

    > However, at least my book will be more correct and helpful than the docs, so I suppose I shouldn't complain. m.

    While I wouldn't expect you to go into as much detail as you would in your book, would you mind elaborating a bit more on your findings? Many people are attempting to adopt UIStoryboard around now, and this is pertinent information.

    --Kyle Sluder
  • On Thu, 22 Dec 2011 10:27:32 -0800, Kyle Sluder <kyle.sluder...> said:
    > On Dec 22, 2011, at 8:59 AM, Matt Neuburg <matt...>  wrote:
    >
    >> 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.
    >
    > Then please file a bug! The documentation authors can't know about and document every bug in the implementation. Often times I believe they work from the specification in order to have the docs ready for release.
    >
    >> However, at least my book will be more correct and helpful than the docs, so I suppose I shouldn't complain. m.
    >
    > While I wouldn't expect you to go into as much detail as you would in your book, would you mind elaborating a bit more on your findings? Many people are attempting to adopt UIStoryboard around now, and this is pertinent information.

    I don't see how this has to do with UIStoryboard. It's about the stated effect of definesPresentationContext on presentingViewController. I do now understand what's really going on with that, I think, and I state my understand in the iOS 5 revision of Chapter 19 of my book:

    https://plus.google.com/115941336284685245715/posts/4rVkXjS5ME5

    I did find that blog post on UIStoryboard very helpful for focussing my formulation of why storyboards, as you say, don't feel ready for prime time. m.

    --
    matt neuburg, phd = <matt...>, <http://www.apeth.net/matt/>
    A fool + a tool + an autorelease pool = cool!
    Programming iOS 4!
    On Dec 24, 2011, at 10:04 AM, Matt Neuburg <matt...> wrote:

    > I don't see how this has to do with UIStoryboard. It's about the stated effect of definesPresentationContext on presentingViewController. I do now understand what's really going on with that, I think, and I state my understand in the iOS 5 revision of Chapter 19 of my book:
    >
    > https://plus.google.com/115941336284685245715/posts/4rVkXjS5ME5

    I'm under the impression that the default segues consult the definesPresentationContext property to configure the actual animation. I could of course be mistaken.

    I was unaware that you were offering the draft of your book for free. Thanks very much for the link.

    Your use of the Music app as an example of view controller presentation puzzles me, though. In my app, I was trying to use the definesPresentationContext property to cause a "push" transition to affect just a view inside a tab bar item inside a navigation controller. Instead, no matter what I tried, the entire root view controller (the navigation controller) was always replaced. Is this because I was on the iPhone? Your book seems to imply that UIModalPresentationCurrentContext is only meaningful on the iPad since the root view controller is always the presentingViewController.

    --Kyle Sluder (Mac Developer)
  • On Sat, 24 Dec 2011 10:32:49 -0800, Kyle Sluder <kyle.sluder...> said:
    > On Dec 24, 2011, at 10:04 AM, Matt Neuburg <matt...>  wrote:

    > I'm under the impression that the default segues consult the definesPresentationContext property to configure the actual animation. I could of course be mistaken.

    I doubt need to "consult" anything. The default segues call what you would have called, e.g. presentViewController. How that works is how that works (and that, indeed, is what I was trying to figure out).

    > I was unaware that you were offering the draft of your book for free. Thanks very much for the link.

    You bet. Not the whole book, alas; O'Reilly would kneecap me if I did that. But the best chapters, for sure. Plus the code is available for download, including *all* the revised code I've done (even from chapters I can't display in public), at my github repository.

    > Your use of the Music app as an example of view controller presentation puzzles me, though. In my app, I was trying to use the definesPresentationContext property to cause a "push" transition to affect just a view inside a tab bar item inside a navigation controller. Instead, no matter what I tried, the entire root view controller (the navigation controller) was always replaced. Is this because I was on the iPhone?

    Yes.

    > Your book seems to imply that UIModalPresentationCurrentContext is only meaningful on the iPad since the root view controller is always the presentingViewController.

    If the book just "seems to imply" this, I'm writing it wrong! I believe I'm jumping up and down and screaming this. Let me know if you think the presentation (sorry, bad pun) can be made clearer.

    And in fact among the downloadable examples I just mentioned is a project that's a universal app constructed in order to demonstrate *exactly* the situation you just described. Plus the chapter I pointed you to has the code. m.

    --
    matt neuburg, phd = <matt...>, <http://www.apeth.net/matt/>
    A fool + a tool + an autorelease pool = cool!
    Programming iOS 4!
    previous month december 2011 next month
    MTWTFSS
          1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30 31  
    Go to today