Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
a85bc54e
Commit
a85bc54e
authored
Nov 26, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AI
parent
d38b6122
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
25 deletions
+17
-25
YHAutoTextView.swift
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
+7
-7
YHAIViewController.swift
...s/Modules/AI/AI-Dialogue(AI对话)/C/YHAIViewController.swift
+3
-4
YHAITextInputView.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
+7
-14
No files found.
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
View file @
a85bc54e
...
...
@@ -33,7 +33,7 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
override
init
(
frame
:
CGRect
,
textContainer
:
NSTextContainer
?)
{
super
.
init
(
frame
:
frame
,
textContainer
:
textContainer
)
delegate
=
self
//
delegate = self
isScrollEnabled
=
false
// 禁止滚动
translatesAutoresizingMaskIntoConstraints
=
false
clearsOnInsertion
=
true
...
...
@@ -51,12 +51,12 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
}
// UITextViewDelegate 方法
func
textViewDidChange
(
_
textView
:
UITextView
)
{
// 更新自身的高度
invalidateIntrinsicContentSize
()
placeholderLabel
.
isHidden
=
!
textView
.
text
.
isEmpty
text
=
textView
.
text
}
//
func textViewDidChange(_ textView: UITextView) {
//
// 更新自身的高度
//
invalidateIntrinsicContentSize()
//
placeholderLabel.isHidden = !textView.text.isEmpty
//
text = textView.text
//
}
override
var
intrinsicContentSize
:
CGSize
{
// 计算内容的尺寸
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIViewController.swift
View file @
a85bc54e
...
...
@@ -55,16 +55,15 @@ class YHAIViewController: YHBaseViewController {
gk_navTitle
=
"AI对话"
self
.
view
.
addSubview
(
self
.
tableView
)
self
.
view
.
addSubview
(
self
.
bottomInputView
)
bottomInputView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
}
tableView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalTo
(
0
)
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
)
make
.
bottom
.
equalTo
(
bottomInputView
.
snp
.
top
)
.
offset
(
-
10
)
}
bottomInputView
.
addKeyBoardNotify
()
bottomInputView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
View file @
a85bc54e
...
...
@@ -12,8 +12,7 @@ import IQKeyboardManagerSwift
class
YHAITextInputView
:
UIView
{
var
sendBlock
:
((
String
)
->
())?
static
let
height
=
72.0
lazy
var
contentView
:
UIView
=
{
let
v
=
UIView
()
v
.
backgroundColor
=
.
white
...
...
@@ -44,6 +43,7 @@ class YHAITextInputView: UIView {
var
textView
:
YHAutoTextView
=
{
let
v
=
YHAutoTextView
(
frame
:
.
zero
)
v
.
font
=
.
PFSC_R
(
ofSize
:
14
)
return
v
}()
...
...
@@ -61,7 +61,6 @@ class YHAITextInputView: UIView {
}
func
addKeyBoardNotify
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleKeyboardNotification(_:)
)
,
name
:
UIResponder
.
keyboardWillShowNotification
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleKeyboardNotification(_:)
)
,
name
:
UIResponder
.
keyboardWillHideNotification
,
object
:
nil
)
}
...
...
@@ -72,7 +71,6 @@ class YHAITextInputView: UIView {
func
createUI
()
{
self
.
addSubview
(
whiteView
)
whiteView
.
addSubview
(
contentView
)
contentView
.
addSubview
(
sendBtn
)
...
...
@@ -85,7 +83,7 @@ class YHAITextInputView: UIView {
contentView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
top
.
equalTo
(
10
)
make
.
bottom
.
equalTo
(
-
2
0
)
make
.
bottom
.
equalTo
(
-
1
0
)
make
.
right
.
equalTo
(
-
20
)
}
...
...
@@ -102,30 +100,25 @@ class YHAITextInputView: UIView {
make
.
bottom
.
equalTo
(
-
16
)
make
.
right
.
equalTo
(
sendBtn
.
snp
.
left
)
.
offset
(
-
10
)
}
addKeyBoardNotify
()
}
@objc
func
handleKeyboardNotification
(
_
notification
:
Notification
)
{
if
notification
.
userInfo
!=
nil
{
guard
let
keyboardFrame
=
(
notification
.
userInfo
?[
UIResponder
.
keyboardFrameEndUserInfoKey
]
as
AnyObject
)
.
cgRectValue
else
{
return
}
let
isKeyboardShow
=
notification
.
name
==
UIResponder
.
keyboardWillShowNotification
let
bottomMargin
=
(
isKeyboardShow
?
-
keyboardFrame
.
height
:
0
)
if
!
isKeyboardShow
{
IQKeyboardManager
.
shared
.
enable
=
true
}
self
.
snp
.
updateConstraints
{
make
in
make
.
bottom
.
equalToSuperview
()
.
offset
(
bottomMargin
)
}
self
.
setNeedsLayout
()
self
.
layoutIfNeeded
()
if
!
isKeyboardShow
{
// self.dismiss()
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment