• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setFrame doesn't work if I put the view into UINavigationController?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setFrame doesn't work if I put the view into UINavigationController?


  • Subject: Re: setFrame doesn't work if I put the view into UINavigationController?
  • From: Kyle Sluder <email@hidden>
  • Date: Sun, 29 Mar 2015 10:20:30 -0600

On Sun, Mar 29, 2015, at 02:39 AM, GongHao [龚浩] wrote:
> I am trying to implement an Android-like drawer by creating a
> UINavigationController category, and add a method like
> [UINavigationController setDrawerViewController:]. The Drawer View
> Controller is actually pushed to screen by [UINavigationController
> pushViewController:animated:], and then I need to change the Drawer
> View's frame to Not fullscreen.
>
> Maybe you are right that I shouldn't try to play with Navigation
> Controller at all.

Aside from the fact that "drawers" (aka "hamburger basements") are not
native iOS UI, adding a category to UINavigationController is definitely
not the way to achieve this goal. UINavigationController expects to own
its childViewControllers array.

You should investigate custom container view controllers. They are the
officially supported way of compositing multiple view controllers in
your interface.

--Kyle Sluder

>
> 在 2015/3/29 15:40, Kyle Sluder 写道:
>
> On Sun, Mar 29, 2015, at 01:26 AM, GongHao [龚浩] wrote:
>
>
> Thanks,
>
> Eventually I got it work by doing it in
> navigationController:didShowViewController:animated:
> UINavigationController will set the content view controller's view size
> in a private method _startTransition:fromViewController:toViewController:
> , changing the frame after this call should work.
>
> This is quite hacky though.
>
>
>
> And it's also not guaranteed to continue working. UINavigationController
> may change your view's frame at any time it wishes—for example, when you
> rotate the device.
>
> As I said, a view controller is not in charge of its view's frame. If
> you need the content of a view controller's view to be positioned
> differently from where the parent view controller decides the view
> should be positioned, you need to add that content as a _subview_ of
> your VC's view.
>
> What are you actually trying to achieve?
>
> --Kyle Sluder
>

_______________________________________________

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


  • Follow-Ups:
    • Re: setFrame doesn't work if I put the view into UINavigationController?
      • From: GongHao [龚浩] <email@hidden>
References: 
 >setFrame doesn't work if I put the view into UINavigationController? (From: GongHao [龚浩] <email@hidden>)
 >Re: setFrame doesn't work if I put the view into UINavigationController? (From: Kyle Sluder <email@hidden>)
 >Re: setFrame doesn't work if I put the view into UINavigationController? (From: GongHao [龚浩] <email@hidden>)
 >Re: setFrame doesn't work if I put the view into UINavigationController? (From: Kyle Sluder <email@hidden>)
 >Re: setFrame doesn't work if I put the view into UINavigationController? (From: GongHao [龚浩] <email@hidden>)

  • Prev by Date: Re: setFrame doesn't work if I put the view into UINavigationController?
  • Next by Date: Re: setFrame doesn't work if I put the view into UINavigationController?
  • Previous by thread: Re: setFrame doesn't work if I put the view into UINavigationController?
  • Next by thread: Re: setFrame doesn't work if I put the view into UINavigationController?
  • Index(es):
    • Date
    • Thread