在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:CFCenterItemViews开源软件地址:https://gitee.com/chengfeisoft/CFCenterItemViews开源软件介绍:CFCenterItemViewsExampleTo run the example project, clone the repo, and run Requirements
Use let topItems = ["home_top_0":"你的优选", "home_top_1":"专属推荐", "home_top_2":"下午茶", "home_top_3":"商家活动"].sorted(by: {return $0.0 < $1.0}) override func viewDidLoad() { super.viewDidLoad() self.title = "平均分布" var items:[CFCenterItemView] = [] let itemViews = CFCenterItemViews(frame: CGRect(x: 0, y: 0, width: containerView.frame.size.width, height: containerView.frame.size.height)) itemViews.touchHandler = { index in print(index) } for (key,value) in topItems { let itemView = CFCenterItemView(frame: CGRect(x: 0, y: 0, width: 0, height: itemViews.frame.size.height)) itemView.backgroundColor = UIColor.white let imageView = UIImageView(image: UIImage(named: key)) let label = UILabel() label.text = value label.font = UIFont.systemFont(ofSize: 15) label.textColor = UIColor.black itemView.setup(imageView: imageView, label: label, gap:10.0) items.append(itemView) } itemViews.setup(items: items) containerView.addSubview(itemViews) } InstallationCFCenterItemViews is available through CocoaPods. To installit, simply add the following line to your Podfile: pod "CFCenterItemViews" Authorchengfei.heng, [email protected] LicenseCFCenterItemViews is available under the MIT license. See the LICENSE file for more info. |
请发表评论