Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Landscape orientation workaround #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GoogleWearAlert/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
7 changes: 5 additions & 2 deletions GoogleWearAlert/GoogleWearAlertView/GoogleWearAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class GoogleWearAlert: NSObject {
var rotate = CGAffineTransformRotate(scale, CGFloat(M_PI))
var transform = CGAffineTransformConcat(scale, rotate)

var currentView = alertQueue.firstObject as GoogleWearAlertView
var currentView = alertQueue.firstObject as! GoogleWearAlertView
currentView.transform = transform

bgWindow.windowLevel = UIWindowLevelAlert
Expand All @@ -102,6 +102,9 @@ class GoogleWearAlert: NSObject {
bgWindow.hidden = true
bgWindow.addSubview(currentView)
bgWindow.makeKeyAndVisible()

// ios8 bug where a nil rootViewController on UIWindow causes its frame not to recalculate when the device's orientation changes
bgWindow.rootViewController = UIViewController()

UIView.animateWithDuration(presentAnimationDuration,
delay: 0.0,
Expand All @@ -123,7 +126,7 @@ class GoogleWearAlert: NSObject {
}

func removeAlert(timer:NSTimer) {
var currentView = timer.userInfo?.objectForKey("currentView")as GoogleWearAlertView
var currentView = timer.userInfo?.objectForKey("currentView")as! GoogleWearAlertView
removeCurrentAlert(currentView)
}

Expand Down