Swiftpack.co - spirit-jsb/InFa as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by spirit-jsb.
spirit-jsb/InFa 1.0.1
A star rating control framework for iOS
⭐️ 1
🕓 1 week ago
iOS
.package(url: "https://github.com/spirit-jsb/InFa.git", from: "1.0.1")

InFa (烟花)

InFa 是一个易于使用的星级展示或接受用户输入评分的控件。

基本属性及方法

StarConfiguration 属性

  • totalStars
  • starSize
  • starMargin
  • fillMode
  • emptyBackgroundColor
  • filledBackgroundColor
  • emptyBorderColor
  • emptyBorderWidth
  • filledBorderColor
  • filledBorderWidth
  • emptyStarImage
  • filledStarImage
  • emptyStarImageTintColor
  • filledStarImageTintColor
  • minimumTouchRating
  • blockingTouches
  • updateByTouch
  • disabledPanGestures

StarConfiguration 方法

  • default()

StarView 属性

  • onTouchingRating
  • endTouchingRating
  • rating
  • starConfiguration

StarView 方法

  • init(starConfiguration:)
  • init(frame:starConfiguration:)
  • update()
  • prepareForReuse()

使用方法

let starView = VMStarView()

/// update star configuration
...

starView.onTouchingRating = { (rating) in
  /// do somethings
}

starView.endTouchingRating = { (rating) in
  /// do somethings
}

starView.rating = 2.7
let starView = VMStarView()

starView.starConfiguration.emptyStarImage = UIImage()
starView.starConfiguration.filledStarImage = UIImage()
starView.starConfiguration.emptyStarImageTintColor = UIColor()
starView.starConfiguration.filledStarImageTintColor = UIColor()

/// update star configuration
...

starView.onTouchingRating = { (rating) in
  /// do somethings
}

starView.endTouchingRating = { (rating) in
  /// do somethings
}

starView.rating = 2.7
let starView = VMStarView()

/// update star configuration
...

starView.onTouchingRating = { (rating) in
  /// do somethings
}

starView.endTouchingRating = { (rating) in
  /// do somethings
}

starView.rating = 2.7

注意:

在 UITableViewCell / UICollectionViewCell 中使用时必须重写 prepareForReuse() 方法

let starView = VMStarView()

...

override func prepareForReuse() {
  self.starView.prepareForReuse()
}

限制条件

  • iOS 10.0+
  • Swift 5.0+

安装

Swift Package Manager

https://github.com/spirit-jsb/InFa.git

作者

spirit-jsb, [email protected]

许可文件

InFa 可在 MIT 许可下使用,更多详情请参阅许可文件。

GitHub

link
Stars: 1
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Release Notes

version 1.0.1
1 week ago

publish version 1.0.1

  • Optimized code
  • Supplement testable code

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics