Skip to content

Commit

Permalink
Merge pull request #2 from bugkingK/test
Browse files Browse the repository at this point in the history
Modify the bug where "nextIndex" is -1 when "currentIndex" is 0.
  • Loading branch information
bawn committed Aug 27, 2020
2 parents 896a6a3 + 6541b63 commit cf7e052
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Trident/MenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,12 @@ public class TridentMenuView: UIView {
, currentIndex >= 0 else {
return
}
nextIndex = currentIndex == titles.count - 1 ? currentIndex - 1 : currentIndex + 1
// nextIndex = min(currentIndex + 1, titles.count - 1)
if currentIndex == titles.count - 1 {
let next = currentIndex - 1
nextIndex = next > 0 ? next : 0
} else {
nextIndex = currentIndex + 1
}
currentLabel = menuItemViews[currentIndex]
}
}
Expand Down

0 comments on commit cf7e052

Please sign in to comment.