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
ff737973
Commit
ff737973
authored
Nov 26, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
25820cf8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
YHAutoTextView.swift
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
+16
-8
YHAITextInputView.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
+5
-1
No files found.
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
View file @
ff737973
...
...
@@ -17,6 +17,7 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
}
}
let
maxHeight
=
105.0
var
placeHolder
:
String
=
""
{
didSet
{
placeholderLabel
.
text
=
placeHolder
...
...
@@ -58,14 +59,21 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
override
var
intrinsicContentSize
:
CGSize
{
// 计算内容的尺寸
// var height = self.getHeight(text: self.text, font: self.font!, width: frame.width)
// if height < 20.0 {
// height = 20.0
// }
// // 加上textView周边的缝隙
// height += 15.0
// var height = self.getHeight(text: self.text, font: self.font!, width: frame.width)
// if height < 20.0 {
// height = 20.0
// }
// // 加上textView周边的缝隙
// height += 15.0
let
size
=
sizeThatFits
(
CGSize
(
width
:
frame
.
width
,
height
:
.
greatestFiniteMagnitude
))
return
CGSize
(
width
:
size
.
width
,
height
:
size
.
height
)
var
height
=
size
.
height
isScrollEnabled
=
height
>
maxHeight
if
height
>
maxHeight
{
height
=
maxHeight
}
return
CGSize
(
width
:
size
.
width
,
height
:
height
)
}
func
getHeight
(
text
:
String
,
font
:
UIFont
,
width
:
CGFloat
)
->
CGFloat
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
View file @
ff737973
...
...
@@ -84,7 +84,7 @@ class YHAITextInputView: UIView {
contentView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
top
.
equalTo
(
10
)
make
.
bottom
.
equalTo
(
-
10
)
make
.
bottom
.
equalTo
(
-
10
-
k_Height_safeAreaInsetsBottom
()
)
make
.
right
.
equalTo
(
-
20
)
}
...
...
@@ -113,6 +113,10 @@ class YHAITextInputView: UIView {
let
isKeyboardShow
=
notification
.
name
==
UIResponder
.
keyboardWillShowNotification
let
bottomMargin
=
(
isKeyboardShow
?
-
keyboardFrame
.
height
:
0
)
contentView
.
snp
.
updateConstraints
{
make
in
make
.
bottom
.
equalTo
(
-
10
-
(
isKeyboardShow
?
0.0
:
k_Height_safeAreaInsetsBottom
()))
}
self
.
snp
.
updateConstraints
{
make
in
make
.
bottom
.
equalTo
(
bottomMargin
)
}
...
...
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