iphone - When I rotate iOS screen, collection view cell is going wrong -
when rotate ios screen without keyboard , it's fine. keyboard, rotate screen, cell going wrong. don't know how explain in english, uploaded screenshot.
swift solution
override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { if uidevice.currentdevice().orientation.islandscape.boolvalue { print("landscape") view.endediting(true) } else { print("portrait") view.endediting(true) } }
objective-c solution
[[uidevice currentdevice] begingeneratingdeviceorientationnotifications]; if ( ([[uidevice currentdevice] orientation] == uideviceorientationportrait) ) { // portrait mode [[self view] endediting:yes]; } else if(([[uidevice currentdevice] orientation] == uideviceorientationlandscaperight) || ([[uidevice currentdevice] orientation] == uiinterfaceorientationlandscapeleft)) { // landscape mode [[self view] endediting:yes]; }
Comments
Post a Comment