UIScrollView bar insets the size of the tab bar and nav bar

225 Views Asked by At

I am using the library Chatto (https://github.com/badoo/Chatto) for a chat window and initializing a view controller that inherits from it's BaseChatViewController.

The issue that i'm having is that while the scroll view can scroll all the way to the top and bottom of the conversation, the place where the scroll bar stops is inset about the same size as the nav bar on the top and the tab bar on the bottom.

The Chatto demo app doesn't appear to have this issue, so I'm wondering if there is something I should be doing differently in my app.

enter image description here

Here is the viewController

import Chatto
import ChattoAdditions
import RxSwift
import UIKit

class ConversationViewController: BaseChatViewController {

  var viewModel: ConversationViewModel!

  private let disposeBag = DisposeBag()

  override func viewDidLoad() {

    super.viewDidLoad()

    title = viewModel.title

  }

  override func viewWillAppear(_ animated: Bool) {

    super.viewWillAppear(animated)

    loadViewModel()

  }

  override func createChatInputView() -> UIView {

    return viewModel.chatInputView

  }

  override func createPresenterBuilders() -> [ChatItemType: [ChatItemPresenterBuilderProtocol]] {

    return viewModel.presenterBuilders

  }

}

// MARK: - MessagesSelectorDelegate

extension ConversationViewController: MessagesSelectorDelegate {

  func messagesSelector(_: MessagesSelectorProtocol, didSelectMessage _: MessageModelProtocol) {

    enqueueModelUpdate(updateType: .normal)

  }

  func messagesSelector(_: MessagesSelectorProtocol, didDeselectMessage _: MessageModelProtocol) {

    enqueueModelUpdate(updateType: .normal)

  }

}

// MARK: - Helpers

extension ConversationViewController {

  private func loadViewModel() {

    ActivityIndicator.shared.show(on: view)

    viewModel.load()
      .subscribe { [weak self] event in

        guard let self = self else {

          Log.error(
            "The ConversationViewController, while reacting to it's viewModel loading, was unable to unwrap self"
          )

          return

        }

        ActivityIndicator.shared.hide()

        switch event {

        case .completed:

          return

        case let .error(error):

          Log.error(error)

          self.presentErrorAlert(error)

        }

      }
      .disposed(by: disposeBag)

  }

}
0

There are 0 best solutions below