pujiaxin33 / JXSegmentedView

A powerful and easy to use segmented view (segmentedcontrol, pagingview, pagerview, pagecontrol, categoryview) (腾讯新闻、今日头条、QQ音乐、网易云音乐、京东、爱奇艺、腾讯视频、淘宝、天猫、简书、微博等所有主流APP分类切换滚动视图)
MIT License
2.69k stars 370 forks source link

screen is empty #132

Closed waleedmakarem closed 2 months ago

waleedmakarem commented 3 years ago

Dear Sir, Thanks for the library, looks great. I am new to swift, I try to make simple use of the library with the following code, but screen is empty, though I add the segmentedviewcontrol to may main view.

class ViewController: UIViewController { var segmentedDataSource: JXSegmentedTitleDataSource! var segmentedView: JXSegmentedView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. view.backgroundColor = .white segmentedView = JXSegmentedView() segmentedDataSource = JXSegmentedTitleDataSource() segmentedDataSource.titles = ["cat" , "dog" , "lion"] segmentedDataSource.isTitleColorGradientEnabled = true segmentedView.dataSource = segmentedDataSource self.view.addSubview(self.segmentedView) }

pujiaxin33 commented 2 months ago

You should retain the instance of JXSegmentedTitleDataSource() in your view controller.