diff --git a/Example/LNSideMenu/Info.plist b/Example/LNSideMenu/Info.plist
index ed6abef..befa8d0 100644
--- a/Example/LNSideMenu/Info.plist
+++ b/Example/LNSideMenu/Info.plist
@@ -35,6 +35,9 @@
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
diff --git a/LNSideMenu.podspec b/LNSideMenu.podspec
index 64e4d5a..93f737c 100644
--- a/LNSideMenu.podspec
+++ b/LNSideMenu.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'LNSideMenu'
- s.version = '3.1'
+ s.version = '3.2'
s.summary = 'A side menu control for iOS in Swift with custom layer and scrolling effect. Right and Left sides. iOS 8+.'
# This description is used to generate tags and improve search results.
diff --git a/LNSideMenu/Classes/LNCommon.swift b/LNSideMenu/Classes/LNCommon.swift
index d3aae0f..eebd89c 100644
--- a/LNSideMenu/Classes/LNCommon.swift
+++ b/LNSideMenu/Classes/LNCommon.swift
@@ -12,7 +12,9 @@ import ObjectiveC
// MARK: Global variables
internal let screenHeight = UIScreen.main.bounds.height
internal let screenWidth = UIScreen.main.bounds.width
-internal let navigationBarHeight: CGFloat = 64
+internal var kNavBarHeight: CGFloat {
+ return UIApplication.shared.statusBarFrame.height + ([.landscapeRight, .landscapeLeft].contains(UIApplication.shared.statusBarOrientation) ? 32 : 44)
+}
internal let kDistanceItemToRight: CGFloat = 18
// MARK: Typealias
diff --git a/LNSideMenu/Classes/LNSideMenu.swift b/LNSideMenu/Classes/LNSideMenu.swift
index da63dd2..8f2bfda 100644
--- a/LNSideMenu/Classes/LNSideMenu.swift
+++ b/LNSideMenu/Classes/LNSideMenu.swift
@@ -19,10 +19,7 @@ public final class LNSideMenu: NSObject {
fileprivate let kGravityDirection: CGFloat = 3.5
fileprivate let shortDuration: TimeInterval = 0.25
fileprivate let maxXPan: CGFloat = 30
- fileprivate var kNavBarHeight: CGFloat {
- return [.landscapeRight, .landscapeLeft].contains(UIApplication.shared.statusBarOrientation) ? 52 : 64
- }
-
+
// MARK: Properties
// This property should be private for this release
fileprivate var menuWidth: CGFloat = UIScreen.main.bounds.width {
diff --git a/LNSideMenu/Classes/LNSideMenuView.swift b/LNSideMenu/Classes/LNSideMenuView.swift
index b498674..a7772b1 100644
--- a/LNSideMenu/Classes/LNSideMenuView.swift
+++ b/LNSideMenu/Classes/LNSideMenuView.swift
@@ -13,12 +13,17 @@ import QuartzCore
internal final class LNSideMenuView: UIView, UIScrollViewDelegate {
// MARK: Constants
+ fileprivate let isPlus = UIScreen.main.bounds.width == 736
fileprivate let kNumberDefaultItemHeight: CGFloat = 60
fileprivate let kNumberDefaultSpace: CGFloat = 30
- fileprivate let kNumberDefaultDistance: CGFloat = 40
+ fileprivate var kNumberDefaultDistance: CGFloat {
+ return isPlus ? 40 : 30
+ }
fileprivate let kNumberDurationAnimation: TimeInterval = 0.25
fileprivate let kNumberDefaultItemsHoziConstant: Int = 2
- fileprivate let kNumberAriProg: Int = 10
+ fileprivate var kNumberAriProg: Int {
+ return isPlus ? 10 : 8
+ }
fileprivate let kNumberVelocityConstant: CGFloat = 60
// MARK: Variables
@@ -120,8 +125,8 @@ internal final class LNSideMenuView: UIView, UIScrollViewDelegate {
// Re-draw shape in self
draw(self.frame)
// Update x position of scrollview
- let distanceToTop = isChanged ? navigationBarHeight : kNumberDefaultSpace
- self.menusScrollView.y = distanceToTop
+ let distanceToTop = isChanged ? kNavBarHeight : kNumberDefaultSpace
+ self.menusScrollView.y = self.menusScrollView.y - 30 + distanceToTop
}
func refresh() {
@@ -166,12 +171,13 @@ internal final class LNSideMenuView: UIView, UIScrollViewDelegate {
// The number of items on screen is always an odd, because it helps to calculate frames of items more easier and cooler
if totalCellOnScreen % 2 == 0 && totalCells > totalCellOnScreen {
totalCellOnScreen -= 1
+ frame.height -= kNumberDefaultItemHeight
}
// CurrentIndex is presented for index of item at center of screen
currentIndex = Int(totalCellOnScreen/2)
index = currentIndex
// Calculate frame of scrollview
- frame.y = kNumberDefaultSpace
+ frame.y = kNumberDefaultSpace + (space - frame.height) / 2
frame.x = isRight ? kNumberDefaultDistance : 0
menusScrollView.frame = frame
}
@@ -209,7 +215,6 @@ internal final class LNSideMenuView: UIView, UIScrollViewDelegate {
let dest = abs(index-currentIndex)
let sum = (0..