Fix animation and layout bugs on iPad Pro
This commit is contained in:
@@ -11,18 +11,29 @@ import UIKit
|
|||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
var mainViewController: MainViewController = MainViewController()
|
||||||
|
|
||||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
|
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
|
||||||
{
|
{
|
||||||
application.statusBarHidden = true
|
application.statusBarHidden = true
|
||||||
|
|
||||||
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
|
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
|
||||||
self.window?.rootViewController = MainViewController()
|
self.window?.rootViewController = self.mainViewController
|
||||||
self.window?.makeKeyAndVisible()
|
self.window?.makeKeyAndVisible()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applicationDidBecomeActive(application: UIApplication)
|
||||||
|
{
|
||||||
|
self.mainViewController.viewDidAppear(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func applicationDidEnterBackground(application: UIApplication)
|
||||||
|
{
|
||||||
|
self.mainViewController.viewDidDisappear(false)
|
||||||
|
}
|
||||||
|
|
||||||
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
|
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask
|
||||||
{
|
{
|
||||||
return UIInterfaceOrientationMask.Landscape
|
return UIInterfaceOrientationMask.Landscape
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ class MainViewController: UIViewController, SwitchesViewControllerDelegate {
|
|||||||
|
|
||||||
override func viewDidAppear(animated: Bool)
|
override func viewDidAppear(animated: Bool)
|
||||||
{
|
{
|
||||||
|
super.viewDidAppear(animated)
|
||||||
|
|
||||||
_headerView.xionLogoView.beginAnimating()
|
_headerView.xionLogoView.beginAnimating()
|
||||||
|
|
||||||
if (!_server.connected) {
|
if (!_server.connected) {
|
||||||
@@ -102,11 +104,6 @@ class MainViewController: UIViewController, SwitchesViewControllerDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidDisappear(animated: Bool)
|
|
||||||
{
|
|
||||||
_headerView.xionLogoView.stopAnimating()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func prefersStatusBarHidden() -> Bool
|
override func prefersStatusBarHidden() -> Bool
|
||||||
{
|
{
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class SwitchesViewController: UIViewController,
|
|||||||
{
|
{
|
||||||
let spacing = SwitchesViewController.collectionViewCellsSpacing
|
let spacing = SwitchesViewController.collectionViewCellsSpacing
|
||||||
let cellsPerRow = CGFloat(SwitchesViewController.collectionViewCellsPerRow)
|
let cellsPerRow = CGFloat(SwitchesViewController.collectionViewCellsPerRow)
|
||||||
let dimensions = rint((collectionView.bounds.size.width / cellsPerRow) - ((spacing * (cellsPerRow - 1.0)) / cellsPerRow))
|
let dimensions = floor((collectionView.bounds.size.width / cellsPerRow) - ((spacing * (cellsPerRow - 1.0)) / cellsPerRow))
|
||||||
|
|
||||||
if (indexPath.item < ActionCell.count) {
|
if (indexPath.item < ActionCell.count) {
|
||||||
return CGSize(width: collectionView.bounds.size.width, height: rint(dimensions / 2.0))
|
return CGSize(width: collectionView.bounds.size.width, height: rint(dimensions / 2.0))
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class XIONLogoView: UIView {
|
|||||||
|
|
||||||
func beginAnimating()
|
func beginAnimating()
|
||||||
{
|
{
|
||||||
|
self.stopAnimating()
|
||||||
|
|
||||||
let duration: NSTimeInterval = 20.0
|
let duration: NSTimeInterval = 20.0
|
||||||
|
|
||||||
let clockwiseAnim = CABasicAnimation(keyPath: "transform.rotation")
|
let clockwiseAnim = CABasicAnimation(keyPath: "transform.rotation")
|
||||||
|
|||||||
Reference in New Issue
Block a user