Когда я пытаюсь отклонить keyBoard в интерактивном режиме, у меня появляется ошибка для моего inputAccessoryView - PullRequest
0 голосов
/ 10 апреля 2019

Я реализовал inputAccessoryView с помощью UITextView.Я также установил collectionView.keyboardDismissMode = .interactive. Когда я закрываю клавиатуру с помощью интерактивного режима, у меня появляется эта две ошибки

1) - Предупреждение первого респондента: '<.InputTextView: 0x7f8f54061800;baseClass = UITextView;кадр = (8 8; 307 35,5);текст = '';clipsToBounds = YES;жестRecognizers =;слой =;contentOffset: {0, 0};contentSize: {130, 0};AdjustContentInset: {0, 0, 0, 0}> 'отклонено resignFirstResponder при удалении из иерархии

2) - [UIWindow endDisablingInterfaceAutorotationAnimated:] вызывается> без соответствия -beginDisablingInterfaceAutorotation.Игнорирование.

Xcode 10 и swift 4

Код для CollectionViewController

lazy var containerView: InputAccesoryView = {

    let frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 50)
    let containerView = InputAccesoryView(frame: frame)

    containerView.backgroundColor = UIColor.groupTableViewBackground
    containerView.autoresizingMask = .flexibleHeight
    containerView.delegate = self

    return containerView
}()

override var inputAccessoryView: UIView {
    get {
        return containerView
    }
}

override var canBecomeFirstResponder: Bool {
    return true
}

Код для InputAccesoryView

public let inputTextView: InputTextView = {
    let textView = InputTextView()
    textView.font = UIFont.systemFont(ofSize: 16)
    textView.isScrollEnabled = false
    textView.textAlignment = .left
    textView.layer.cornerRadius = 10
    return textView
}()

private lazy var sendButton: UIButton = {
    let button = UIButton(type: .system)
    button.setImage(UIImage(named: "send2"), for: .normal)
    button.tintColor = .black
    button.addTarget(self, action: #selector(handleUploadComment), for: .touchUpInside)
    return button
}()

override init(frame: CGRect) {
    super.init(frame: frame)

    configureViewComponents()
}

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
}

override var intrinsicContentSize: CGSize {
    return CGSize.zero
}

private func configureViewComponents(){


    addSubview(sendButton)
    sendButton.setPosition(top: nil, left: nil, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 8, width: 44, height: 0)
    sendButton.centerYAnchor.constraint(equalTo: layoutMarginsGuide.centerYAnchor).isActive = true

    addSubview(inputTextView)
    inputTextView.setPosition(top: topAnchor, left: leftAnchor, bottom: layoutMarginsGuide.bottomAnchor, right: sendButton.leftAnchor, paddingTop: 8, paddingLeft: 8, paddingBottom: 8, paddingRight: 8, width: 0, height: 0)

    let separatorView = UIView()
    separatorView.backgroundColor = UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 1)
    addSubview(separatorView)
    separatorView.setPosition(top: topAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 0, height: 0.5)
}

func clearCommentTextView() {
    inputTextView.text = nil
    inputTextView.placeHolder.isHidden = false
}
...