Tho Nguyen Tho Nguyen - 2 months ago 5x
iOS Question

Add subView immediately after view presented

I have 2 view A and B.
At view A

presentViewController(viewB, animation: true) {

At view B:
var masterView:UIView!

func addButton(notification: NSNotification){
var button:UIButton!
button.frame = masterView.caculator // set frame for button

When view B finished animation on simulator( go from Bottom). Button added after delay 0.3s.

Following some document, when animation finish, method viewDidAppear called. i tried this way. But as I saw, button added after animation finish 0.3s

How to addButton immediately when animation finish?
Thank you!


I have solved it. Because in viewDidAppear, this method was called when all Layout is loaded. So we need implement add my button in LayoutSubview Method.