diff --git a/DropdownMenu/DropdownMenu.swift b/DropdownMenu/DropdownMenu.swift index 0022bf3..09d1a99 100644 --- a/DropdownMenu/DropdownMenu.swift +++ b/DropdownMenu/DropdownMenu.swift @@ -54,10 +54,16 @@ open class DropdownMenu: UIView { private let iPhoneXPortraitTopOffset: CGFloat = 88.0 private let portraitTopOffset: CGFloat = 64.0 private let landscapeTopOffset: CGFloat = 32.0 + private var topLayoutConstraintConstant: CGFloat { var offset: CGFloat = 0 if !navigationController.isNavigationBarHidden { - offset = navigationController.navigationBar.frame.height + navigationController.navigationBar.frame.origin.y + if let navigationBarWindow = navigationController.view.window { + let convertRect = navigationController.view.convert(navigationController.navigationBar.frame, to: navigationBarWindow) + offset = convertRect.height + convertRect.origin.y + } else { + offset = navigationController.navigationBar.frame.height + navigationController.navigationBar.frame.origin.y + } } return offset + topOffsetY } @@ -165,7 +171,6 @@ open class DropdownMenu: UIView { } @objc func updateForOrientationChange(_ nofication: Notification) { - print("UIApplicationWillChangeStatusBarOrientation") if let oriention = (nofication as NSNotification).userInfo?[UIApplication.statusBarOrientationUserInfoKey] as? Int { var topOffset: CGFloat switch oriention { diff --git a/DropdownMenuDemo/DropdownMenuDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/DropdownMenuDemo/DropdownMenuDemo/Assets.xcassets/AppIcon.appiconset/Contents.json index eeea76c..d8db8d6 100644 --- a/DropdownMenuDemo/DropdownMenuDemo/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/DropdownMenuDemo/DropdownMenuDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -64,6 +84,11 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/DropdownMenuDemo/DropdownMenuDemo/Base.lproj/Main.storyboard b/DropdownMenuDemo/DropdownMenuDemo/Base.lproj/Main.storyboard index 8d143d5..6ef051f 100644 --- a/DropdownMenuDemo/DropdownMenuDemo/Base.lproj/Main.storyboard +++ b/DropdownMenuDemo/DropdownMenuDemo/Base.lproj/Main.storyboard @@ -1,19 +1,16 @@ - - - - + + - - + - + @@ -23,41 +20,48 @@ - + - + + @@ -65,12 +69,14 @@ + + @@ -106,7 +112,7 @@ - + @@ -131,7 +137,7 @@ - + @@ -173,7 +179,7 @@ - + diff --git a/DropdownMenuDemo/DropdownMenuDemo/ViewController.swift b/DropdownMenuDemo/DropdownMenuDemo/ViewController.swift index 52fc596..214ba15 100644 --- a/DropdownMenuDemo/DropdownMenuDemo/ViewController.swift +++ b/DropdownMenuDemo/DropdownMenuDemo/ViewController.swift @@ -75,6 +75,11 @@ class ViewController: UIViewController { @IBAction func sectionSwitchValueChanged(_ sender: AnyObject) { showSection = sectionSwitch.isOn } + + @IBAction func presentAction(_ sender: Any) { + let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ViewController") + present(UINavigationController(rootViewController: vc), animated: true, completion: nil) + } } extension ViewController: DropdownMenuDelegate {