ios - How to make viewcontroller to show as bottom page in ios10 swift3? -
i have 1 view controller button, if click on button should display bottom view controller (like bottom page in android):
i have these 2 demo view controllers, if click on button second view controller should display details view , should popup bottom of first view controller.
thank you.
for achieving should add second view controller child view controller , animate bottom. adding child:
let secondviewcontrollerinstance = secondviewcontroller() // or storyboard instantiate method self.addchildviewcontroller(secondviewcontrollerinstance) let initialrect = cgrect(x: 0, y: screen_height-200, width: screen_width, height: 200) secondviewcontrollerinstance.view.frame = rect secondviewcontrollerinstance.view.center.y += 100 self.view.addsubview(secondviewcontrollerinstance.view) secondviewcontrollerinstance.didmove(toparentviewcontroller: self) //animate center y uiview.animate(withduration: 0.3) { secondviewcontrollerinstance.view.center.y -= 100 }
tweak heights , widths according requirement.
Comments
Post a Comment