diff --git a/README.md b/README.md
index aabfb23..607da13 100644
--- a/README.md
+++ b/README.md
@@ -1,30 +1,30 @@
# StarReview
===
-#####下面有中文说明
-##StarReview is a iOS Rate tool. it use common star to rate something
-StarReview is a powerful iOS UI tool. It is a UIControl subclass that creates a customizable rating view containing rating stars in it.
+##StarReview is a iOS Rate tool. it use common star to rate something【StarReview是一个IOS打分工具,用星星来给某些东西打分】
+StarReview is a powerful iOS UI tool. It is a UIControl subclass that creates a customizable rating view containing rating stars in it.
+【StarReview是一个强大的IOS UI 工具他继承了UIControl 并提供了可定制的包含可打分星星的VIew.】
##Key Features
-* Self-adaptive size. the view size and star count determine the star size.
-* Can add any star count.
-* Set the star fill color and background color.
-* Custom star gap.
-* Use float or int to present star value.
-* Change star value will fire event when you add target.
+* Self-adaptive size. the view size and star count determine the star size.**可自适配大小,星的大小由VIew的大小和星星的个数决定**
+* Can add any star count.**可设定任意星星的个数**
+* Set the star fill color and background color.**可设定填充颜色和背景色**
+* Custom star gap.**自定义星与星之间的间距**
+* Use float or int to present star value.**可用小数或者整数来表示当前星的分数**
+* Change star value will fire event when you add target-action.**改变星的值时会触发事件,当你为它添加target action时**
-##Requirements
+##Requirements 【系统需要】
Xcode 7.1 and iOS 8.0(the lasted swift grammar)
-
-##Installation
-`if you want to use cocopods, just pod 'StarReview'.`
-`if you want to use file, just pod copy the StarReview.swift to your project .`
+【Xcode 7.1 and iOS 8.0(最新的Swift语法)】
+##Installation 【安装】
++ if you want to use Cocoapods, just pod 'StarReview'**如果你想用Cocoapods,那再pod 'StarReview' 就行**
++ if you want to use file, just pod copy the StarReview.swift to your project .**如果你想使用文件 直接拷贝StarReview.swift文件到你的项目里面就行**
-##How To Use It
-*Please see these code below
+##How To Use It 【怎么使用】
+Please see these code below**请参考下面的代码**
```swift
let star = StarReview(frame: CGRect(x: 15, y: 100, width: 200, height: 50)) //init the StarReview
```
@@ -56,8 +56,8 @@ star.addTarget(self, action: "valueChange:", forControlEvents: UIControlEvents.V
```
view.addSubview(star) //add the StarReview
```
-*Check the demo project will help you understand more
-
+Check the demo project will help you understand more
+**参考Demo项目的代码会更好理解**
![add -DDEBUG location](https://raw.githubusercontent.com/DuckDeck/StarReview/master/StarReviewDemo/StarReviewDemo/Resource/1.gif)
@@ -71,83 +71,5 @@ view.addSubview(star) //add the StarReview
##Contact
Any issue or problem please contact me:3421902@qq.com, I will be happy fix it
+**任何问题或者BUG请直接和我联系3421902@qq.com, 我会乐于帮你解决**
-
-
-
-#中文说明
-
-
-# StarReview
-===
-##StarReview是一个IOS打分工具,用星星来给某些东西打分
-
-StarReview是一个强大的IOS UI 工具他继承了UIControl 并提供了可定制的包含星星的VIew.
-
-##关键特点
-* 可自适配大小,星的大小由VIew的大小和星星的个数决定
-* 可设定任意星星的个数
-* 可设定填充颜色和背景色
-* 自定义星与星之间的间距
-* 可用小数或者整数来表示当前星的分数
-* 改变星的值时会触发事伯,当你添加target时
-
-##系统要求
-
-Xcode 7.1 and iOS 8.0(最新的Swift语法)
-
-##安装
-`如果你使用cocopods, 则pod 'StarReview' 再安装即可.`
-
-`如果你想使用文件,直接拷贝StarReview.swift到你的项目即可`
-
-
-
-##怎么使用
-*请参考以下代码
-```swift
-let star = StarReview(frame: CGRect(x: 15, y: 100, width: 200, height: 50)) //初始化 StarReview
-```
-```swift
-star.starMarginScale = 0.3 //设置星与星的间隔长度和星星直径的比例,默认是 0.3
-```
-```
-star.value = 2 //设置 StarReview 的 value
-```
-```
-star.starCount = 5 // 设置StarReview内星星的个数,默认是5个
-```
-```
-star.allowEdit = true // 设置是否可以允许打分,默认是允许
-```
-```
-star.allowAccruteStars = true //设置是否精确化打分,也就是说如果是精确化,就可以用小数,不然只能用整数
-
-```
-```
-star.starFillColor = UIColor.orangeColor() //设置星星的填充颜色
-```
-```
-star.starBackgroundColor = UIColor.lightGrayColor() //设置星星的背景色
-```
-```
-star.addTarget(self, action: "valueChange:", forControlEvents: UIControlEvents.ValueChanged) // 为StarReview的值改变时添加事件
-```
-```
-view.addSubview(star) //添加StarReview
-```
-*参考StarReviewDemo会更好的理解StarReview怎么使用
-
-
-
-![add -DDEBUG location](https://raw.githubusercontent.com/DuckDeck/StarReview/master/StarReviewDemo/StarReviewDemo/Resource/1.gif)
-
-
-![add -DDEBUG location](https://raw.githubusercontent.com/DuckDeck/StarReview/master/StarReviewDemo/StarReviewDemo/Resource/2.gif)
-
-
-![add -DDEBUG location](https://raw.githubusercontent.com/DuckDeck/StarReview/master/StarReviewDemo/StarReviewDemo/Resource/3.gif)
-
-
-##和我联系
-任何问题或者BUG请直接和我联系3421902@qq.com, 我会乐于帮你解决
diff --git a/StarReviewDemo/StarReviewDemo/ViewController.swift b/StarReviewDemo/StarReviewDemo/ViewController.swift
index af07fae..04316c3 100644
--- a/StarReviewDemo/StarReviewDemo/ViewController.swift
+++ b/StarReviewDemo/StarReviewDemo/ViewController.swift
@@ -18,55 +18,68 @@ class ViewController: UIViewController,UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.whiteColor()
- star = StarReview(frame: CGRect(x: 15, y: 100, width: 200, height: 50))
- star?.starMarginScale = 0.4;
- star!.value = 2
- star?.starCount = 6
+
+ //setup first star view
+ star = StarReview(frame: CGRect(x: 15, y: 100, width: 200, height: 50))
+ star?.starMarginScale = 0.4;
+ star!.value = 2
+ star?.starCount = 6
star?.allowAccruteStars = true
star!.addTarget(self, action: #selector(ViewController.valueChange(_:)), forControlEvents: UIControlEvents.ValueChanged)
view.addSubview(star!)
- let btnBar = UIBarButtonItem(title: "换色", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.changeColor))
- navigationItem.rightBarButtonItem = btnBar
- btnBarLeft = UIBarButtonItem(title: "整数化", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.inter))
- navigationItem.leftBarButtonItem = btnBarLeft!
- lblStarLevel = UILabel(frame: CGRect(x: 0, y: 180, width: 200, height: 20))
+ //setup lable for present first star view's value
+ lblStarLevel = UILabel(frame: CGRect(x: 0, y: 180, width: 200, height: 20))
lblStarLevel?.textColor = UIColor.blackColor()
+ lblStarLevel?.text = "分数值\(star!.value)"
view.addSubview(lblStarLevel!)
- slider = UISlider(frame: CGRect(x: 0, y: 200, width: UIScreen.mainScreen().bounds.width, height: 50))
+
+ //setup slider which work in coordination with first star view
+ slider = UISlider(frame: CGRect(x: 0, y: 200, width: UIScreen.mainScreen().bounds.width, height: 50))
slider?.maximumValue = Float(star!.starCount)
slider?.minimumValue = 0
slider?.addTarget(self, action: #selector(ViewController.sliderChangeValue(_:)), forControlEvents: UIControlEvents.ValueChanged)
view.addSubview(slider!)
- txtStarValue = UITextField(frame: CGRect(x: 200, y: 175, width: 100, height: 30))
- txtStarValue?.keyboardType = UIKeyboardType.DecimalPad
- txtStarValue?.delegate = self;
+
+ //setup text view used for set first star view's value
+ txtStarValue = UITextField(frame: CGRect(x: 230, y: 175, width: 100, height: 30))
+ txtStarValue?.keyboardType = UIKeyboardType.DecimalPad
+ txtStarValue?.delegate = self;
txtStarValue?.layer.borderWidth = 0.5
+ txtStarValue?.placeholder = "Set value"
txtStarValue?.layer.borderColor = UIColor.redColor().CGColor
view.addSubview(txtStarValue!)
- let star2 = StarReview(frame: CGRect(x: 10, y: 220, width: 150, height: 70))
- star2.starCount = 5
- star2.value = 1
- star2.allowAccruteStars = true
- star2.starFillColor = UIColor.redColor()
+ //setup second star view
+ let star2 = StarReview(frame: CGRect(x: 15, y: 250, width: 150, height: 70))
+ star2.starCount = 5
+ star2.value = 1
+ star2.allowAccruteStars = true
+ star2.starFillColor = UIColor.redColor()
star2.starBackgroundColor = UIColor.blackColor()
- star2.starMarginScale = 0.3
+ star2.starMarginScale = 0.3
view.addSubview(star2)
- let star3 = StarReview(frame: CGRect(x: 150, y: 280, width: 150, height: 70))
-
- star3.starCount = 5
- star3.allowAccruteStars = true
- star3.starMarginScale = 0.5
- star3.value = 3.3
+ //setup third star view
+ let star3 = StarReview(frame: CGRect(x: 15, y: 320, width: 150, height: 70))
+ star3.starCount = 5
+ star3.allowAccruteStars = true
+ star3.starMarginScale = 0.5
+ star3.value = 3.3
star3.starBackgroundColor = UIColor.lightGrayColor()
- star3.starFillColor = UIColor.orangeColor()
+ star3.starFillColor = UIColor.orangeColor()
view.addSubview(star3)
+
+ //setup button for change star color
+ let btnBar = UIBarButtonItem(title: "换色", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.changeColor))
+ navigationItem.rightBarButtonItem = btnBar
+
+ //setup button for change star value between integer and non-integer.
+ btnBarLeft = UIBarButtonItem(title: "整数化", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.inter))
+ navigationItem.leftBarButtonItem = btnBarLeft!
}
-
func valueChange(sender:StarReview){
slider?.value = sender.value
lblStarLevel?.text = "分数值\(sender.value)"
@@ -101,10 +114,7 @@ class ViewController: UIViewController,UITextFieldDelegate {
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
}
-
-
}