LoginSignup
2
2

More than 5 years have passed since last update.

Swiftチュートリアル(初めての方に対して)

Last updated at Posted at 2015-11-11

Implement a Custom Control/カスタムコントロールを実装にて、ミスがあります。

下記コード記述の際に必要なプロパティが存在しないためエラーが出ます。

override func intrinsicContentSize() -> CGSize {
        let buttonSize = Int(frame.size.height)
        let width = (buttonSize + spacing) * stars

        return CGSize(width: width, height: buttonSize)
    }

僕は下記のコードを記述して解決しました。

// MARK: Properties 星を出現させるためのプロパティを記述する。
//追加するプロパティです。
    var spacing = 5
    var stars = 5

参考URL
https://forums.developer.apple.com/thread/23021
http://inaka-gurashi.hatenablog.com/entry/%E4%BA%BA%E5%B7%A5%E7%9F%A5%E8%83%BD%E5%8D%B1%E9%99%BA%E6%80%A7
https://programmer-engine.work/archives/16831

2
2
2

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
2
2