Latest 0.1.0
Homepage https://github.com/swift365/CFCenterItemViews
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

<img src="https://github.com/swift365/CFCenterItemViews/blob/master/Example/CFCenterItemViews/shot.png"  alt="效果展示" height="568" width="320" />

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8.0+
  • Xcode8+
  • Swift 3

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)

    }

Installation

CFCenterItemViews is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "CFCenterItemViews"

Author

chengfei.heng, [email protected]

License

CFCenterItemViews is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CFCenterItemViews",
    "version": "0.1.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "CFCenterItemViews is a Swift module for subViews to uiview.",
    "homepage": "https://github.com/swift365/CFCenterItemViews",
    "authors": {
        "chengfei.heng": "[email protected]"
    },
    "source": {
        "git": "https://github.com/swift365/CFCenterItemViews.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": [
        "CFCenterItemViews/Classes/*.swift",
        "CFCenterItemViews/Classes/**/*.swift"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This