Skip to content

Commit

Permalink
Merge pull request #15 from Wzxhaha/master
Browse files Browse the repository at this point in the history
Open isShow & Update maxHeight when don't display section header
  • Loading branch information
suricforever authored Apr 19, 2018
2 parents eb9df47 + 4a5a5be commit 6cbb1b8
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 1,248 deletions.
525 changes: 0 additions & 525 deletions Carthage/Build/iOS/0072A021-A0C8-3E42-8785-053FF6530D9A.bcsymbolmap

This file was deleted.

525 changes: 0 additions & 525 deletions Carthage/Build/iOS/8EF0BB32-843B-378C-8330-3325067C0497.bcsymbolmap

This file was deleted.

20 changes: 0 additions & 20 deletions Carthage/Build/iOS/DropdownMenu.framework.dSYM/Contents/Info.plist

This file was deleted.

Binary file not shown.
Binary file not shown.
142 changes: 0 additions & 142 deletions Carthage/Build/iOS/DropdownMenu.framework/Headers/DropdownMenu-Swift.h

This file was deleted.

19 changes: 0 additions & 19 deletions Carthage/Build/iOS/DropdownMenu.framework/Headers/DropdownMenu.h

This file was deleted.

Binary file removed Carthage/Build/iOS/DropdownMenu.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 0 additions & 10 deletions Carthage/Build/iOS/DropdownMenu.framework/Modules/module.modulemap

This file was deleted.

18 changes: 11 additions & 7 deletions DropdownMenu/DropdownMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ open class DropdownMenu: UIView {

open var tableView: UITableView!
fileprivate var barCoverView: UIView?
fileprivate var isShow = false
open var isShow = false
fileprivate var addedWindow: UIWindow?
fileprivate var windowRootView: UIView?
fileprivate var topConstraint: NSLayoutConstraint?
Expand Down Expand Up @@ -72,9 +72,7 @@ open class DropdownMenu: UIView {
}
open var separatorStyle: UITableViewCellSeparatorStyle = .singleLine {
didSet {
if let tableView = tableView {
tableView.separatorStyle = separatorStyle
}
tableView.separatorStyle = separatorStyle
}
}
open var tableViewSeperatorColor = UIColor(red: 217.0/255.0, green: 217.0/255.0, blue: 217.0/255.0, alpha: 1.0) {
Expand Down Expand Up @@ -173,8 +171,8 @@ open class DropdownMenu: UIView {
fileprivate func initTableView() {
tableView = UITableView(frame: CGRect.zero, style: .grouped)
tableView.separatorStyle = separatorStyle
tableView?.delegate = self
tableView?.dataSource = self
tableView.delegate = self
tableView.dataSource = self
tableView.estimatedSectionFooterHeight = 0
tableView.estimatedSectionHeaderHeight = 0
addSubview(tableView)
Expand All @@ -184,9 +182,15 @@ open class DropdownMenu: UIView {
tableView.translatesAutoresizingMaskIntoConstraints = false

tableViewHeight = tableviewHeight()

let maxHeight = navigationController.view.frame.height - topLayoutConstraintConstant - defaultBottonMargin

if tableViewHeight > maxHeight {
tableViewHeight = maxHeight
if displaySectionHeader {
tableViewHeight = maxHeight
} else {
tableViewHeight = round(maxHeight / rowHeight) * rowHeight
}
}

NSLayoutConstraint.activate([NSLayoutConstraint.init(item: tableView, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant:0)])
Expand Down

0 comments on commit 6cbb1b8

Please sign in to comment.