ios - Presenting a ViewController over another ViewController -
i've got pretty lengthy question today, takes amount of explaining. let's start example.
example
let's have 3 view controllers:
- fullsizeviewcontroller
- firstviewcontroller
- secondviewcontroller
fullsizeviewcontroller, name states, intended take space of whole screen. firstviewcontroller , secondviewcontroller, on other hand, should take 3/4 of height of screen. here's few pictures illustrate.
here have fullsizeviewcontroller. nothing special, 2 buttons - "first" & "second". if haven't caught on now, 2 buttons should toggle each of respective view controllers, shown below.
the issue
i'm having main issues this? how able to
- animate view controllers bottom
- change size of 2 smaller view controllers
- still allow interaction fullsizeviewcontroller small view controller open on top of main content, not 2 toggle buttons?
what i've tried
since i'm not sure how this, haven't tried much, have tried 1 thing.
in ibaction connected "first" button:
let firstvc: firstviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("firstviewcontroller")! firstviewcontroller self.presentviewcontroller(firstvc, animated: true, completion: nil)
in viewdidload of firstviewcontroller:
self.view.frame.size = cgsizemake(uiscreen.mainscreen().bounds.size.width, uiscreen.mainscreen().bounds.size.height - 68)
tl;dr how can achieve this?
your full size vc should custom container view controller. when want 1 of other controllers come on screen, instantiate it, size how want, add child view controller, , use animatewithduration change frame off bottom of screen want end up. shouldn't use presentviewcontroller since gives modal vc takes on whole screen. should read document called "implementing custom container view controller" if haven't already.
Comments
Post a Comment