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
0884fac0
Commit
0884fac0
authored
Dec 10, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
91244bed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
34 deletions
+38
-34
YHAIMainChatViewController.swift
...s/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
+38
-34
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIMainChatViewController.swift
View file @
0884fac0
...
@@ -347,43 +347,47 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -347,43 +347,47 @@ extension YHAIMainChatViewController: UITableViewDelegate, UITableViewDataSource
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
let
message
=
messages
[
indexPath
.
row
]
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
messages
.
count
{
let
msgType
=
message
.
getType
()
let
message
=
messages
[
indexPath
.
row
]
if
!
message
.
isTextMessage
()
{
let
msgType
=
message
.
getType
()
return
UITableView
.
automaticDimension
if
!
message
.
isTextMessage
()
{
}
return
UITableView
.
automaticDimension
}
let
text
=
message
.
body
.
contentText
// 要显示的文本内容
let
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
// 字体大小
let
text
=
message
.
body
.
contentText
// 要显示的文本内容
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
// 字体大小
let
maxWidth
=
KScreenWidth
-
20*
2
-
16*
2
// 最大宽度限制
let
attributes
=
[
NSAttributedString
.
Key
.
font
:
font
]
as
[
NSAttributedString
.
Key
:
Any
]
let
size
=
(
text
as
NSString
)
.
boundingRect
(
with
:
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
),
options
:
.
usesLineFragmentOrigin
,
attributes
:
attributes
,
context
:
nil
)
.
size
let
attributes
=
[
NSAttributedString
.
Key
.
font
:
font
]
as
[
NSAttributedString
.
Key
:
Any
]
let
size
=
(
text
as
NSString
)
.
boundingRect
(
with
:
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
),
options
:
.
usesLineFragmentOrigin
,
attributes
:
attributes
,
context
:
nil
)
.
size
var
textHeight
=
ceil
(
size
.
height
)
var
textHeight
=
ceil
(
size
.
height
)
if
textHeight
<
20.0
{
if
textHeight
<
20.0
{
textHeight
=
20.0
textHeight
=
20.0
}
}
if
message
.
isSelf
||
message
.
getType
()
==
.
recommendText
{
if
message
.
isSelf
||
msgType
==
.
recommendText
{
return
textHeight
+
16.0
*
2
+
16.0
return
textHeight
+
16.0
*
2
+
16.0
}
}
let
complete
=
message
.
isDone
let
complete
=
message
.
isDone
let
isNeedShowCopyView
=
complete
let
isNeedShowCopyView
=
complete
let
isNeedShowLoadingView
=
!
complete
let
isNeedShowLoadingView
=
!
complete
var
resultHeight
=
textHeight
+
16.0
*
2.0
var
resultHeight
=
textHeight
+
16.0
*
2.0
if
isNeedShowLoadingView
{
if
isNeedShowLoadingView
{
resultHeight
+=
(
18
+
6
)
resultHeight
+=
(
18
+
6
)
}
if
isNeedShowCopyView
{
resultHeight
+=
(
16
+
37
)
}
else
{
resultHeight
+=
16
}
return
resultHeight
}
}
if
isNeedShowCopyView
{
return
UITableView
.
automaticDimension
resultHeight
+=
(
16
+
37
)
}
else
{
resultHeight
+=
16
}
return
resultHeight
}
}
...
...
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