Set UITableView content inset permanently

前端 未结 8 735
余生分开走
余生分开走 2020-12-07 12:24

In my app I have a UISearchBar under UINavigationBar so it is always visible to user. In that case I had to set contentInset with extr

相关标签:
8条回答
  • 2020-12-07 12:51
          self.rx.viewDidAppearOnce
                .flatMapLatest { _ in RxKeyboard.instance.isHidden }
                .bind(onNext: { [unowned self] isHidden in
                    guard !isHidden else { return }
                    self.tableView.beginUpdates()
                    self.tableView.contentInsetAdjustmentBehavior = .automatic
                    self.tableView.endUpdates()
                })
                .disposed(by: self.disposeBag)
    
    0 讨论(0)
  • 2020-12-07 12:53

    This is how it can be fixed easily through Storyboard (iOS 11 and Xcode 9.1):

    Select Table View > Size Inspector > Content Insets: Never

    0 讨论(0)
提交回复
热议问题