Closed AgungLaksana closed 5 years ago
I just recently update the pod from pod 1.3.0 to 1.4.0
here is the code I use to set up the segmented control
import ScrollableSegmentedControl @IBOutlet weak var segmentedController: ScrollableSegmentedControl! segmentedController.segmentStyle = .textOnly segmentedController.insertSegment(withTitle: "asasasa", at: 0) segmentedController.insertSegment(withTitle: "Semua", at: 0) segmentedController.insertSegment(withTitle: "Kopi", at: 1) segmentedController.insertSegment(withTitle: "Air Dalam Kemasan", at: 2) segmentedController.insertSegment(withTitle: "Makanan Instan", at: 3) segmentedController.insertSegment(withTitle: "Susu", at: 4) segmentedController.insertSegment(withTitle: "Sabun Cuci Piring", at: 5) segmentedController.insertSegment(withTitle: "Bumbu Dapur", at: 6) segmentedController.underlineSelected = true segmentedController.addTarget(self, action: #selector(HomeVC.segmentSelected(sender:)), for: .valueChanged) // change some colors segmentedController.segmentContentColor = UIColor.darkGray segmentedController.selectedSegmentContentColor = UIColor.darkGray segmentedController.backgroundColor = UIColor.white segmentedController.tintColor = UIColor.black // underline color // default position segmentedController.selectedSegmentIndex = 0 segmentedController.fixedSegmentWidth = false
but I dont know why the app crash in line: segmentedController.insertSegment(withTitle: "asasasa", at: 0)
with error message: Thread 1: Fatal error: Index out of range
it worked without problem in 1.3.0, but since I update in 1.4.0 it makes crash.
I use Xcode 10, Swift 4.2
Case closed:
here is what I do to solve this problem:
I just recently update the pod from pod 1.3.0 to 1.4.0
here is the code I use to set up the segmented control
but I dont know why the app crash in line: segmentedController.insertSegment(withTitle: "asasasa", at: 0)
it worked without problem in 1.3.0, but since I update in 1.4.0 it makes crash.
I use Xcode 10, Swift 4.2