【问题标题】:Collectionview contentSize wrongCollectionview contentSize 错误
【发布时间】:2013-02-18 15:37:14
【问题描述】:

我目前正在使用UICollectionView 开发应用程序。我需要知道 contentSize 的高度,我正在这样做

self.collectionView.collectionViewLayout.collectionViewContentSize.height

现在这可以正常工作了,但是对于纵向模式,返回的值总是不正确的。我应该怎么做才能达到我的需要?

【问题讨论】:

    标签: ios cocoa-touch uicollectionview


    【解决方案1】:

    只需在 viewDidAppear 和 didRotateFromInterfaceOrientation 中获取 self.colletonView.contentSize

    - (void)viewDidAppear:(BOOL)animated{
         NSLog(@"%0.0f-%0.0f",self.collectionView.contentSize.width,self.collectionView.contentSize.height);
    }
    
    -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
        NSLog(@"%0.0f-%0.0f",self.collectionView.contentSize.width,self.collectionView.contentSize.height);
    }
    

    【讨论】:

      猜你喜欢
      • 2014-02-11
      • 2019-10-12
      • 2016-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 2017-07-16
      相关资源
      最近更新 更多