2013-12-16 21 views
0

我在每個UICollectionViewCell中都有一個帶有3個自定義視圖的UICollectionView。我需要在一個單元格中使這3個視圖更大,但我找不到訪問這些視圖的大小屬性的方法。有什麼辦法可以做到嗎? 預先感謝您。如何更改UICollectionViewCell內部元素的大小?

+0

@AaronBrager' - (void)layoutSubviews {self.firstView.bounds.size.height = 50; }'返回一個錯誤「表達式不可賦值」 – piligreem

+0

@AaronBrager非常感謝! ' - (void)layoutSubviews { CGRect cardbounds = self.firstView.bounds; cardbounds.size = CGSizeMake(10,10); self.firstView.bounds = cardbounds; }' 實際上工作。 – piligreem

回答

0

如果您是UICollectionViewCell的子類,您可以在layoutSubviews中調整它們的大小。如果要在控制器中構建單元格,則可以爲子視圖指定一個標記,然後使用viewWithTag:來獲取它們。

相關問題