1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Swift】Eurekaの画像サイズを大きくする法法

Last updated at Posted at 2021-10-01

課題

Swiftのフォームライブラリ「Eureka」のImageRowの画像サイズが小さいと感じたが、大きくする方法がなかなか見つからず苦戦したのでメモとして残しておきます。

解決コード

    <<< ImageRow() {
        //セルの高さ
        $0.cell.height = { 120 }
        //表示させる画像のframe
        $0.cell.accessoryView?.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
        //任意で角丸を設定(無くても良い)
        $0.cell.accessoryView?.layer.cornerRadius = 2
        $0.cell.accessoryView?.clipsToBounds = true

        $0.title = "画像"
        $0.sourceTypes = [.PhotoLibrary, .SavedPhotosAlbum, .Camera]
        $0.clearAction = .yes(style: .destructive)
        $0.placeholderImage = UIImage(named: "dummy")
        $0.onChange { [unowned self] row in
            self.ImageView.image = row.value ?? UIImage(named: "dummy")
        }
    }

accessoryViewで設定するのがミソ。

ビフォーアフター

標準の画像サイズと比較するとご覧のようにかなり見やすくなっている。

・ビフォー
Simulator Screen Shot - iPhone 11 Pro - 2021-10-02 at 01.54.54.png
・アフター(セル120px,画像100px)
Simulator Screen Shot - iPhone 11 Pro - 2021-10-02 at 01.54.10.png

おすすめ情報

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?