XCode UICollectionViewCell 在模擬器上看起來比在故事板中小得多 (XCode UICollectionViewCell appearing much smaller on simulator than in storyboard)


問題描述

XCode UICollectionViewCell 在模擬器上看起來比在故事板中小得多 (XCode UICollectionViewCell appearing much smaller on simulator than in storyboard)

我正在創建一個使用 UICollectionView 的應用程序。我在 UICollectionViewCell 中有一個 UIImageView。在情節提要上, UICollectionViewCell 和圖像的大小是正確的,但是當我嘗試在模擬器上運行它時,模擬器上出現的圖像相對於視圖控制器要小得多。我嘗試更改單元格的大小,但圖像總是以相同的小得多的大小出現在模擬器上。我認為這可能是因為圖像可能太小,即使我將其設置為與單元格相同的尺寸,所以我使用了尺寸比當前圖像大 50 像素的圖像。但是當我在模擬器上運行它時,它仍然默認為更小的尺寸。對於此事,我非常感謝您的幫助。


參考解法

方法 1:

  1. try placing your setupUI in

    viewDidAppear instead on viewDidLoad


    </li>

  2. and what type of iPhone you run and what type of iPhone when you use storyboard? well, if you use iPhone 5s in your storyboard it'll sure look bigger than 10+ right?


  3. </ol>

    because iphone 5 has smaller resolution than 10

    1. You need to post your code, because i can't really assume what is your issue

    (by Rishik SathuaAdli R)

    參考文件

    1. XCode UICollectionViewCell appearing much smaller on simulator than in storyboard (CC BY‑SA 2.5/3.0/4.0)

#uicollectionviewcell #iOS #XCode #swift #uicollectionview






相關問題

Sel UICollectionView tidak terlihat (UICollectionView cells are invisible)

UICollectionViewCell裡面的UIWebView不調用Delegate方法 (UIWebView inside UICollectionViewCell does not call Delegate Method)

Bộ sưu tập xem vấn đề thay đổi kích thước iPhone 4 và iPhone 5 (Collection view resizing issue iPhone 4 vs iPhone 5)

集合視圖單元格未出現 (Collection View Cells not appearing)

UICollectionView 單元格大小 ContentView 問題 (UICollectionView cell size ContentView Issue)

在 Swift 中使用 CollectionView 進行網格佈局 (Grid layout with CollectionView in Swift)

如何為collectionviewcell的刪除自定義動畫? (How to custom animation for collectionviewcell's deletion?)

檢測位於另一個 uicollectionview 內的 uicollectionView 的哪個 UICollectionViewCell 在中心 (Detect which UICollectionViewCell of a uicollectionView that is inside another uicollectionview is in the center)

navigationController?.pushViewController 不工作 (navigationController?.pushViewController is not working)

XCode UICollectionViewCell 在模擬器上看起來比在故事板中小得多 (XCode UICollectionViewCell appearing much smaller on simulator than in storyboard)

CollectionViewCell 未出現在 collectionView 中 (CollectionViewCell not appearing in collectionView)

由 LPLinkView 和 UIImageView 組成的單元格的 CollectionView 速度很慢,並且在滾動時會重新加載數據 (CollectionView with Cells made up of LPLinkView's and UIImageView's is Slow and Reloads Data While Scrolling)







留言討論