LoginSignup
0
0

More than 1 year has passed since last update.

【自分用メモ】Cosmosという星5段階評価できるライブラリ

Posted at

「星5段階評価できるライブラリ」とか無いだろうか?と思って調べたら
『Cosmos』というライブラリがあった。

以下の記事が参考になったが
CosmosViewそのものをタップしたら星の数が変化するので
rateStarsActionとrateButtonに関する以下のコードは

個人的には不要だと思った。

@IBOutlet var rateButton: [UIButton]!

    //ボタンを角丸にする
    rateButton.forEach({ $0.layer.cornerRadius = 20.0 })

@IBAction func rateStarsAction(_ sender: UIButton) {
    //押されたボタンの数に応じて表示する星の数を変更する
    cosmosView.rating = Double(sender.tag)
}

《参考記事》【Xcode/Swift】Cosmosというライブラリを使ってみた
https://masasophi.com/howtousecosmos/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0