Skip to content

Commit 088eb59

Browse files
committed
support zero inset seperator
1 parent 963ef52 commit 088eb59

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

DropdownMenu.xcworkspace/xcuserdata/zhangxiaolian.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
ignoreCount = "0"
1111
continueAfterRunningActions = "No"
1212
filePath = "DropdownMenu/DropdownMenu.swift"
13-
timestampString = "537247484.54931"
13+
timestampString = "543491683.296456"
1414
startingColumnNumber = "9223372036854775807"
1515
endingColumnNumber = "9223372036854775807"
16-
startingLineNumber = "141"
17-
endingLineNumber = "141"
16+
startingLineNumber = "145"
17+
endingLineNumber = "145"
1818
landmarkName = "updateForOrientationChange(_:)"
1919
landmarkType = "7">
2020
</BreakpointContent>

DropdownMenu/DropdownMenu.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public extension DropdownMenuDelegate {
3030

3131
open class DropdownMenu: UIView {
3232
fileprivate weak var navigationController: UINavigationController!
33+
3334
fileprivate var sections: [DropdownSection] = []
3435
fileprivate var selectedIndexPath: IndexPath
36+
3537
open var tableView: UITableView!
3638
fileprivate var barCoverView: UIView?
3739
fileprivate var isShow = false
@@ -80,6 +82,8 @@ open class DropdownMenu: UIView {
8082
tableView.separatorColor = tableViewSeperatorColor
8183
}
8284
}
85+
open var zeroInsetSeperatorIndexPaths: [IndexPath] = []
86+
8387
open var cellBackgroundColor = UIColor.white
8488

8589
open var displaySelected: Bool = true
@@ -342,6 +346,12 @@ extension DropdownMenu: UITableViewDataSource {
342346
cell.accessoryView = UIImageView(image: accesoryImage)
343347
}
344348

349+
if zeroInsetSeperatorIndexPaths.contains(indexPath) {
350+
cell.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
351+
} else {
352+
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.layoutMargins.left, bottom: 0, right: 0)
353+
}
354+
345355
return cell
346356
}
347357

DropdownMenuDemo/DropdownMenuDemo/ViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class ViewController: UIViewController {
5151
menuView = DropdownMenu(navigationController: navigationController!, items: [item1, item2, item3, item4], selectedRow: selectedRow)
5252
}
5353
menuView?.topOffsetY = CGFloat(offSetSlider.value)
54-
menuView?.separatorStyle = .none
54+
//menuView?.separatorStyle = .none
55+
menuView?.zeroInsetSeperatorIndexPaths = [IndexPath(row: 1, section: 0)]
5556
menuView?.delegate = self
5657
menuView?.rowHeight = 50
5758
menuView?.showMenu()

0 commit comments

Comments
 (0)