ios - UIViewController view's frame changes after present(viewController: animated: completion: ) -
i have uiviewcontroller
set size in viewdidload
that:
//setting view's frame let width = uiscreen.main.bounds.size.width - 10 let height = (43 * uiscreen.main.bounds.height) / 100 //%43 of screen self.view.frame = cgrect(x: 5, y: 80, width: width, height: height)
it works great until try present viewcontroller
that:
//presenting autocompletevc self.autocompletevc = gmsautocompleteviewcontroller() self.autocompletevc.delegate = self self.present(self.autocompletevc, animated: true, completion: nil)
after dismiss view (self.autocompletevc.dismiss(animated: true, completion: nil)
) frame of first viewcontroller
's view changes full screen's frame.
any idea how fix it?
thanks!
set frame in viewwillappear
if doesn't work in viewwilllayoutsubviews
this:
public override func viewwilllayoutsubviews() { super.viewwilllayoutsubviews() //setting view's frame let width = uiscreen.main.bounds.size.width - 10 let height = (43 * uiscreen.main.bounds.height) / 100 //%43 of screen self.view.frame = cgrect(x: 5, y: 80, width: width, height: height) }
Comments
Post a Comment