# TCSegment **Repository Path**: coolerting/tcsegment ## Basic Information - **Project Name**: TCSegment - **Description**: No description available - **Primary Language**: Swift - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-04-25 - **Last Updated**: 2021-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TCSegment #### 介绍 标签切换控件,支持约束 #### 示例 ![TCSegment](TCSegment.gif) #### 使用方法 ``` TCSegment.titleColor = UIColor.white let segment = TCSegment(segments: ["1","2","3","4"]) segment.delegate = self view.addSubview(segment) let top = NSLayoutConstraint(item: segment, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 100) let left = NSLayoutConstraint(item: segment, attribute: .left, relatedBy: .equal, toItem: view, attribute: .left, multiplier: 1, constant: 10) let right = NSLayoutConstraint(item: segment, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1, constant: -10) let height = NSLayoutConstraint(item: segment, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: 40) view.addConstraint(top) view.addConstraint(left) view.addConstraint(right) view.addConstraint(height) ```