Skip to content

Commit

Permalink
Modify the bug where "nextIndex" is -1 when "currentIndex" is 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugkingK committed Aug 27, 2020
1 parent 021762f commit 6541b63
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 @@ -242,8 +242,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 6541b63

Please sign in to comment.