GithubHelp home page GithubHelp logo

kkkkkxxxxx / starrate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chenjie1219/starrate

0.0 1.0 0.0 12.1 MB

swift电商五星评价,星星评分控件,支持自定义数量、拖拽、间隔、设置最小星星数等操作

Swift 94.74% Objective-C 5.26%

starrate's Introduction

Swift Carthage Compatible Platform

StarRate

主要内容的介绍

  • 进行评分(支持点击,滑动,最少星星数设置)

  • 展示评分

  • 类型选择(整颗星,半颗星,部分星星)

Requirements

  • Swift 5.0
  • iOS 9.0.0+
  • Xcode 10.2

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

To integrate StarRate into your Xcode project using Carthage, specify it in your Cartfile:

github "chenjie1219/StarRate"

Run carthage update to build the framework and drag the built StarRateView.framework into your Xcode project.

Manually

Just download the project, and drag and drop the "StarRateView" folder in your project.


Usage

1.创建星级视图(可进行评分)

/// 创建视图对象(totalStarCount:总星星数量, currentStarCount:当前星星数, starSpace:星星的间隔)
let starView = StarRateView(frame: CGRect(x: 0, y: 0, width: 120, height: 20),totalStarCount: 5 ,currentStarCount: 0 ,starSpace: 5)

/// 显示星级视图(type:星星类型, isPanEnable:是否可滑动评分, leastStar:评分的最少星星数) 
starView.show(type: .default, isPanEnable: true, leastStar: 0) { (score) in
    /// 评分后的回调方法
    <#code#>
}

2.创建星级视图(不可评分,仅展示当前评分)

/// 创建视图对象(totalStarCount:总星星数量, currentStarCount:当前星星数, starSpace:星星的间隔)
let starView = StarRateView(frame: CGRect(x: 0, y: 0, width: 120, height: 20),totalStarCount: 5 ,currentStarCount: 3 ,starSpace: 5)

/// 关闭用户手势操作,默认是开启的(关闭后不可点击,不可滑动,仅用来显示当前评分)
starView.isUserInteractionEnabled = false//不支持用户手势操作

效果图

1

Author

starrate's People

Contributors

chenjie1219 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.