|
@@ -0,0 +1,172 @@
|
|
|
+//
|
|
|
+// ModifyDataNickNameSignView.swift
|
|
|
+// RainbowPlanet
|
|
|
+//
|
|
|
+// Created by 南鑫林 on 2019/6/19.
|
|
|
+// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
|
+//
|
|
|
+
|
|
|
+import UIKit
|
|
|
+import IQKeyboardManagerSwift
|
|
|
+class ModifyDataNickNameSignView: BaseView {
|
|
|
+
|
|
|
+ var nickNameTextViewSize : CGSize?
|
|
|
+ var signNameTextViewSize : CGSize?
|
|
|
+
|
|
|
+ override func setupViews() {
|
|
|
+ backgroundColor = .white
|
|
|
+ addSubview(nickBgView)
|
|
|
+ nickBgView.addSubview(nickNameLabel)
|
|
|
+ nickBgView.addSubview(nickNameTextView)
|
|
|
+ addSubview(signBgView)
|
|
|
+ addSubview(lineLabel)
|
|
|
+ signBgView.addSubview(signNameLabel)
|
|
|
+ signBgView.addSubview(signNameTextView)
|
|
|
+ }
|
|
|
+
|
|
|
+ override func setupLayouts() {
|
|
|
+ nickBgView.snp_makeConstraints { (make) in
|
|
|
+ make.left.right.top.equalToSuperview()
|
|
|
+ make.height.equalTo(56)
|
|
|
+ }
|
|
|
+ nickNameLabel.snp_makeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo(14)
|
|
|
+ make.width.equalTo(32)
|
|
|
+ make.height.equalTo(23)
|
|
|
+ }
|
|
|
+ nickNameTextView.snp_makeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo(nickNameLabel.snp_right).offset(16)
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.height.equalTo(23)
|
|
|
+ }
|
|
|
+ lineLabel.snp_makeConstraints { (make) in
|
|
|
+ make.top.equalTo(nickBgView.snp.bottom)
|
|
|
+ make.left.equalTo(nickNameLabel)
|
|
|
+ make.right.equalToSuperview()
|
|
|
+ make.height.equalTo(1)
|
|
|
+ }
|
|
|
+ signBgView.snp_makeConstraints { (make) in
|
|
|
+ make.top.equalTo(lineLabel.snp_bottom)
|
|
|
+ make.left.right.equalTo(nickBgView)
|
|
|
+ make.height.equalTo(56)
|
|
|
+ }
|
|
|
+ signNameLabel.snp_makeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo(14)
|
|
|
+ make.width.equalTo(32)
|
|
|
+ make.height.equalTo(23)
|
|
|
+ }
|
|
|
+ signNameTextView.snp_makeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo(signNameLabel.snp_right).offset(16)
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.height.equalTo(23)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ lazy var nickBgView: UIView = {
|
|
|
+ let nickBgView = UIView()
|
|
|
+ nickBgView.backgroundColor = .white
|
|
|
+ return nickBgView
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var nickNameLabel: UILabel = {
|
|
|
+ let nickNameLabel = UILabel()
|
|
|
+ nickNameLabel.text = "昵称"
|
|
|
+ nickNameLabel.textColor = k333333Color
|
|
|
+ nickNameLabel.font = kRegularFont16
|
|
|
+ return nickNameLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var nickNameTextView: IQTextView = {
|
|
|
+ let nickNameTextView = IQTextView()
|
|
|
+ nickNameTextView.placeholder = "添加昵称"
|
|
|
+ nickNameTextView.textColor = k999999Color
|
|
|
+ nickNameTextView.font = kRegularFont16
|
|
|
+ nickNameTextView.tintColor = kThemeColor
|
|
|
+ nickNameTextView.isScrollEnabled = false
|
|
|
+ nickNameTextView.textContainer.lineFragmentPadding = 0
|
|
|
+ nickNameTextView.textContainerInset = .zero
|
|
|
+ nickNameTextView.rx.text.orEmpty.changed.subscribe(onNext: {
|
|
|
+ [weak self] (text) in
|
|
|
+ TextLimitTool.restrictionInputTextView((self?.nickNameTextView)!, maxNumber: 16)
|
|
|
+ let constraintSize = CGSize(width: (self?.nickNameTextView.frame.size.width)!, height: CGFloat(MAXFLOAT))
|
|
|
+ self?.nickNameTextViewSize = self?.nickNameTextView.sizeThatFits(constraintSize)
|
|
|
+ let height = (self?.nickNameTextViewSize?.height ?? 23) + 66 + (self?.signNameTextViewSize?.height ?? 23)
|
|
|
+ self?.frame = CGRect(x: 0, y: 10 + 148 + 10 + kNavBarTotalHeight, width: kScreenWidth, height: height)
|
|
|
+
|
|
|
+ self?.nickBgView.snp.remakeConstraints { (make) in
|
|
|
+ make.top.equalToSuperview()
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
+ make.height.equalTo(33 + (self?.nickNameTextViewSize?.height ?? 23))
|
|
|
+ }
|
|
|
+ self?.nickNameTextView.snp.remakeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo((self?.nickNameLabel.snp_right)!).offset(16)
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.height.equalTo((self?.nickNameTextViewSize?.height ?? 23))
|
|
|
+ }
|
|
|
+
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ return nickNameTextView
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var lineLabel: UILabel = {
|
|
|
+ let lineLabel = UILabel()
|
|
|
+ lineLabel.backgroundColor = kf5f5f5Color
|
|
|
+ return lineLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var signBgView: UIView = {
|
|
|
+ let signBgView = UIView()
|
|
|
+ signBgView.backgroundColor = .white
|
|
|
+ return signBgView
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var signNameLabel: UILabel = {
|
|
|
+ let signNameLabel = UILabel()
|
|
|
+ signNameLabel.text = "签名"
|
|
|
+ signNameLabel.textColor = k313334Color
|
|
|
+ signNameLabel.font = kRegularFont16
|
|
|
+ return signNameLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var signNameTextView: IQTextView = {
|
|
|
+ let signNameTextView = IQTextView()
|
|
|
+ signNameTextView.placeholder = "添加个人简介,让更多的彩虹居民认识你~"
|
|
|
+ signNameTextView.textColor = k999999Color
|
|
|
+ signNameTextView.font = kRegularFont16
|
|
|
+ signNameTextView.tintColor = kThemeColor
|
|
|
+ signNameTextView.isScrollEnabled = false
|
|
|
+ signNameTextView.textContainer.lineFragmentPadding = 0
|
|
|
+ signNameTextView.textContainerInset = .zero
|
|
|
+ signNameTextView.rx.text.orEmpty.changed.subscribe(onNext: {
|
|
|
+ [weak self] (text) in
|
|
|
+ TextLimitTool.restrictionInputTextView((self?.signNameTextView)!, maxNumber: 24)
|
|
|
+ let constraintSize = CGSize(width: (self?.signNameTextView.frame.size.width)!, height: CGFloat(MAXFLOAT))
|
|
|
+ self?.signNameTextViewSize = self?.signNameTextView.sizeThatFits(constraintSize)
|
|
|
+
|
|
|
+ let height = (self?.nickNameTextViewSize?.height ?? 23) + 66 + (self?.signNameTextViewSize?.height ?? 23)
|
|
|
+
|
|
|
+ self?.frame = CGRect(x: 0, y: 10 + 148 + 10 + kNavBarTotalHeight, width: kScreenWidth, height: height)
|
|
|
+
|
|
|
+ self?.signBgView.snp.remakeConstraints { (make) in
|
|
|
+ make.top.equalTo((self?.lineLabel.snp_bottom)!)
|
|
|
+ make.left.right.equalTo((self?.nickBgView)!)
|
|
|
+ make.height.equalTo(33 + (self?.signNameTextViewSize?.height ?? 23))
|
|
|
+ }
|
|
|
+ self?.signNameTextView.snp.remakeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.left.equalTo((self?.signNameLabel.snp_right)!).offset(16)
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.height.equalTo((self?.signNameTextViewSize?.height ?? 23))
|
|
|
+ }
|
|
|
+
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ return signNameTextView
|
|
|
+ }()
|
|
|
+
|
|
|
+}
|
|
|
+
|