I am making an app with View pager app, I am using XLPagerTabStrip library for making it. It works fine with Title in the Viewpager item. I want to add Icon and corresponding Label in it.
Asked
Active
Viewed 2,011 times
1 Answers
7
There reason behind the crash is, the UIImageView is missing in the ButtonCell.xib.
Solution is:
- Open ButtonBarViewCell class,from the top navigation menu of xcode,click on the ButtonBarViewCell.There you can see the ButtonCell.xib.
- Open ButtonCell.xib,drag and drop a UIImage view at the center of the cell.Apply Constrains.and connect it to the IBOutlet imageView.
- Go back to ButtonBarViewCell class and Add this line of code inside func willMove(toSuperview newSuperview: UIView?) function.
if imageView.superview != nil { contentView.addSubview(imageView) }
4.Go back to the class implementing the page and add this code
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: "",image: UIImage(named: "camera.png"))
}
5.done
`

Jaisan Mathew
- 81
- 1
- 9