Skip to content

Commit

Permalink
Fixed rotation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ömer Aslan committed Mar 28, 2016
1 parent 430a3e1 commit 6b574b5
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Classes/OEANotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class OEANotification : UIView {
isDismissable: Bool
) {

self.notify(title, subTitle: subTitle, image: image, type: type, isDismissable: isDismissable, completion: {})
self.notify(title, subTitle: subTitle, image: image, type: type, isDismissable: isDismissable, completion: nil, touchHandler: nil)
}

/**
Expand All @@ -80,7 +80,8 @@ public class OEANotification : UIView {
image: UIImage?,
type: NotificationType,
isDismissable: Bool,
completion: () -> Void
completion: (() -> Void)?,
touchHandler: (() ->Void)?
) {
let notificationView: NotificationView = NotificationView(
frame: rect,
Expand All @@ -89,11 +90,14 @@ public class OEANotification : UIView {
image: image,
type: type,
completionHandler: completion,
touchHandler: touchHandler,
isDismissable: isDismissable
)

OEANotification.notificationCount++
OEANotification.removeOldNotifications()

print(OEANotification.viewController.view.frame)
if OEANotification.viewController.navigationController != nil {
OEANotification.viewController.navigationController!.view.addSubview(notificationView)
} else {
Expand Down Expand Up @@ -158,19 +162,12 @@ public class OEANotification : UIView {
}
}


// Checking device's rotation process and remove notifications to handle UI conflicts.
static public func rotateRecognizer() {
self.rotated = self.rotated ? false : true
if self.rotated {
removeOldNotifications()
UIApplication.sharedApplication().delegate?.window??.windowLevel = UIWindowLevelNormal
rect = CGRectMake(constant.nvMarginLeft, constant.nvStartYPoint, OEANotification.viewController.view.frame.height - constant.nvMarginLeft - constant.nvMarginRight, constant.nvHeight)
} else {
removeOldNotifications()
UIApplication.sharedApplication().delegate?.window??.windowLevel = UIWindowLevelNormal
rect = CGRectMake(constant.nvMarginLeft, constant.nvStartYPoint, OEANotification.viewController.view.frame.width - constant.nvMarginLeft - constant.nvMarginRight, constant.nvHeight)
}

removeOldNotifications()
UIApplication.sharedApplication().delegate?.window??.windowLevel = UIWindowLevelNormal
self.rect = CGRectMake(constant.nvMarginLeft, constant.nvStartYPoint, OEANotification.viewController.view.frame.width - constant.nvMarginLeft - constant.nvMarginRight, constant.nvHeight)
}


Expand Down

0 comments on commit 6b574b5

Please sign in to comment.