Code Monkey home page Code Monkey logo

ddstartratingview's Introduction

前言

最近做的在线客服聊天需要用到星星评分控件,记得之前做电影票订购的练习项目的时候用到过星星评分控件,但是没有封装成独立的类,今天就索性抽点时间把控件封装好,提高开发效率。 原理其实很简单

  • 绘制上下两层星,获取点击星星的坐标,然后改变上层的frame,这样上下两层就能产生视觉差。

效果

##如何使用 (1)初始化控件

    [[DDStartRatingView alloc] initWithFrame:CGRectMake(20, 30, 280, 260) delegate:self];

(2)实现代理方法

    -(void)starRatingView:(DDStartRatingView *)view touchIndex:(int)index

TODO

(1)目前只做了5个星星的评价,以后可以做成可定制的,根据传入的个数自动生成星星。 (2)目前只能整数个星星的评价,以后可以做成根据手指的滑动,按比例显示星星,也可以实现打分效果。

##感谢 感谢开源项目TQStarRatingView的作者TinyQ

博客: http://www.liuchendi.com

ddstartratingview's People

Contributors

lcddhr avatar

Stargazers

MohsinAli avatar

Watchers

MohsinAli avatar  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.