【问题标题】:Scaling UICollectionViewCells down as more added to UICollectionView随着更多添加到 UICollectionView 中,缩小 UICollectionViewCells
【发布时间】:2013-08-13 15:16:25
【问题描述】:

我正在尝试使用自动布局来缩小一些UICollectionViewCells,因为UICollectionView 中添加了更多内容

我有一个应用程序,当用户键入 UICollectionViewCell 时,它会使用键入的字母(如磁贴)创建。

目前视图在 5 之后开始下降。我想做的是在到达右边缘时缩小单元格内的 UICollectionViewCellUILabel

【问题讨论】:

    标签: ios ios6 uicollectionview autolayout uicollectionviewcell


    【解决方案1】:
    #pragma mark - Collection View Data Flow Layout
    -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    //    NSLog(@"%s",__PRETTY_FUNCTION__);
        NSLog(@"the word array count is: %i",self.wordArray.count);
        if (self.wordArray.count <= 5) {
            return CGSizeMake(50,50);
        } else if (self.wordArray.count <= 6 ) {
            return CGSizeMake(30, 30);
        } else if (self.wordArray.count <= 8 ) {
            return CGSizeMake(10, 10);
        } else {
            return CGSizeMake(100,100);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多