ios - Cocoa orientation changes during applicationDidBecomeActive(), how to fix it? -


i coding viewcontroller controls constraint working in specific orientation, change constant when orientation changed.

but when application resignactive screen changes orientation twice, constraint works weird.

code:

private func updateforecourtheightconstraint() {     // todo: function work portrait orientation 'cause ios change orientation during resignactive/becomeactive     let screenportraitheight = uiscreen.mainscreen().bounds.height > uiscreen.mainscreen().bounds.width ? uiscreen.mainscreen().bounds.height : uiscreen.mainscreen().bounds.width     forecourtheightconstraint.constant = screenportraitheight - 80     roottableview.contentinset = uiedgeinsetsmake(forecourtheightconstraint.constant, 0, 0, 0)     print(uiapplication.sharedapplication().statusbarorientation.isportrait) } 

on ipad mini 2 device output

#app started true true #resignactive false true #resignactive false true 

thanks


Comments