iOS7: UICollectionView appearing under UINavigationBar

后端 未结 5 1154
囚心锁ツ
囚心锁ツ 2021-02-01 06:56

I\'ve been building on iOS 7 for a while now but I\'ve yet to get this solved, I have a number of views with autolayout enabled that were created in Storyboard and are displayed

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 07:13

    -(void) viewDidLoad{
        [super viewDidLoad];
        self.automaticallyAdjustsScrollViewInsets = NO; //added  important
    } 
    
    - (void) viewDidLayoutSubviews {
        [super viewDidLayoutSubviews];
        CGFloat top = self.topLayoutGuide.length;
        CGFloat bottom = self.bottomLayoutGuide.length;
        UIEdgeInsets newInsets = UIEdgeInsetsMake(top, 0, bottom, 0);
        self.collectionView.contentInset = newInsets;
    
    }
    

提交回复
热议问题