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
77cfa604
Commit
77cfa604
authored
Dec 02, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
ccdc9079
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
15 deletions
+41
-15
YHAIRobotChatViewController.swift
.../AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
+1
-1
YHAIChatBannerView.swift
...s/Modules/AI/AI-Dialogue(AI对话)/V/YHAIChatBannerView.swift
+7
-7
YHAIChatCustomFlowLayout.swift
...les/AI/AI-Dialogue(AI对话)/V/YHAIChatCustomFlowLayout.swift
+33
-7
No files found.
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIRobotChatViewController.swift
View file @
77cfa604
...
...
@@ -168,7 +168,7 @@ extension YHAIRobotChatViewController: UITableViewDelegate, UITableViewDataSourc
let
view
=
YHAIChatBannerView
()
let
arr
:[
YHBannerModel
]
=
[
YHBannerModel
(),
YHBannerModel
(),
YHBannerModel
()]
view
.
dataArr
=
arr
view
.
historyItems
=
[
"阿萨法吉林师范"
,
"阿萨法
"
,
"啊设计立卡"
,
"啊积"
,
"阿基德拉屎就发了"
,
"asfasf"
,
"阿萨法"
,
"啊设计立卡"
,
"啊积"
,
"阿基德拉屎就发了"
]
view
.
items
=
[
"阿萨法吉林师范"
,
"阿萨法阿基德拉屎就发了阿基德拉屎就发了阿基德拉屎就发了阿基德拉屎就发了阿基德拉屎就发了阿基德拉屎就发了阿基德拉屎就发了
"
,
"啊设计立卡"
,
"啊积"
,
"阿基德拉屎就发了"
,
"asfasf"
,
"阿萨法"
,
"啊设计立卡"
,
"啊积"
,
"阿基德拉屎就发了"
]
return
view
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIChatBannerView.swift
View file @
77cfa604
...
...
@@ -14,9 +14,9 @@ class YHAIChatBannerView: UIView {
static
let
bannerHeight
=
242.0
let
cellHeight
:
CGFloat
=
33.0
// 单元格的固定高度
var
historyI
tems
:[
String
]
=
[]
{
var
i
tems
:[
String
]
=
[]
{
didSet
{
layout
.
dataSource
=
historyI
tems
layout
.
dataSource
=
i
tems
collectionView
.
reloadData
()
}
}
...
...
@@ -156,7 +156,7 @@ extension YHAIChatBannerView: UICollectionViewDelegate, UICollectionViewDataSour
// 返回单元格数量
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
historyI
tems
.
count
return
i
tems
.
count
}
// 返回每个单元格的大小
...
...
@@ -168,15 +168,15 @@ extension YHAIChatBannerView: UICollectionViewDelegate, UICollectionViewDataSour
// 返回自定义单元格
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHAIChatBannerCollectionCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHAIChatBannerCollectionCell
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
historyI
tems
.
count
{
cell
.
titleLabel
.
text
=
historyI
tems
[
indexPath
.
item
]
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
i
tems
.
count
{
cell
.
titleLabel
.
text
=
i
tems
[
indexPath
.
item
]
}
return
cell
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
historyI
tems
.
count
{
let
text
=
historyI
tems
[
indexPath
.
item
]
if
0
<=
indexPath
.
item
&&
indexPath
.
item
<
i
tems
.
count
{
let
text
=
i
tems
[
indexPath
.
item
]
}
}
}
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAIChatCustomFlowLayout.swift
View file @
77cfa604
...
...
@@ -13,10 +13,36 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout {
let
cellHeight
=
33.0
let
verticalGap
=
10.0
let
horizonalGap
=
10.0
var
firstLineX
:
CGFloat
=
0.0
var
secondLineX
:
CGFloat
=
0.0
var
firstLineX
=
0.0
var
secondLineX
=
0.0
let
firstLineY
=
10.0
let
secondLineY
=
10.0
+
33.0
+
10.0
var
attributes
:
[
UICollectionViewLayoutAttributes
]
=
[]
// var dataSource:[String] = [] {
// didSet {
// attributes.removeAll()
// firstLineX = 0.0
// secondLineX = 0.0
// for (index, text) in dataSource.enumerated() {
// let attribute = UICollectionViewLayoutAttributes(forCellWith: IndexPath(row: index, section: 0))
// if index % 2 == 0 { // 第一行的数据
// let size = self.getSize(index: index)
// attribute.frame = CGRectMake(firstLineX, verticalGap, size.width, size.height)
// firstLineX = firstLineX + attribute.frame.width + horizonalGap
//
// } else { // 第二行的数据
// let size = self.getSize(index: index)
// attribute.frame = CGRectMake(secondLineX, verticalGap+cellHeight+verticalGap, size.width, size.height)
// secondLineX = secondLineX + attribute.frame.width + horizonalGap
// }
// attributes.append(attribute)
// }
// collectionView?.reloadData()
// }
// }
var
dataSource
:[
String
]
=
[]
{
didSet
{
attributes
.
removeAll
()
...
...
@@ -24,14 +50,14 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout {
secondLineX
=
0.0
for
(
index
,
text
)
in
dataSource
.
enumerated
()
{
let
attribute
=
UICollectionViewLayoutAttributes
(
forCellWith
:
IndexPath
(
row
:
index
,
section
:
0
))
if
index
%
2
==
0
{
// 第一行的数据
let
size
=
self
.
getSize
(
index
:
index
)
attribute
.
frame
=
CGRectMake
(
firstLineX
,
verticalGap
,
size
.
width
,
size
.
height
)
if
firstLineX
<=
secondLineX
{
attribute
.
frame
=
CGRectMake
(
firstLineX
,
firstLineY
,
size
.
width
,
size
.
height
)
firstLineX
=
firstLineX
+
attribute
.
frame
.
width
+
horizonalGap
}
else
{
// 第二行的数据
let
size
=
self
.
getSize
(
index
:
index
)
attribute
.
frame
=
CGRectMake
(
secondLineX
,
verticalGap
+
cellHeight
+
verticalGap
,
size
.
width
,
size
.
height
)
}
else
{
attribute
.
frame
=
CGRectMake
(
secondLineX
,
secondLineY
,
size
.
width
,
size
.
height
)
secondLineX
=
secondLineX
+
attribute
.
frame
.
width
+
horizonalGap
}
attributes
.
append
(
attribute
)
...
...
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