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
f2d7ce99
Commit
f2d7ce99
authored
Jan 25, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 双项选择题
parent
b3264fb0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
YHDoubleChoiceQuestionCell.swift
...ss(流程)/FamilyMember/View/YHDoubleChoiceQuestionCell.swift
+23
-14
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/FamilyMember/View/YHDoubleChoiceQuestionCell.swift
View file @
f2d7ce99
...
@@ -20,10 +20,12 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
...
@@ -20,10 +20,12 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
let
confirmTag
=
9527
let
confirmTag
=
9527
let
negativeTag
=
9528
let
negativeTag
=
9528
var
question
:
String
?
{
var
responseBlock
:((
Bool
)
->
Void
)?
var
title
:
String
?
{
didSet
{
didSet
{
if
let
question
=
question
{
if
let
question
=
title
{
let
str
=
"*"
+
question
let
str
=
"*"
+
question
let
attributes
:
[
NSAttributedString
.
Key
:
Any
]
=
[
let
attributes
:
[
NSAttributedString
.
Key
:
Any
]
=
[
.
font
:
UIFont
.
PFSCR
(
ofSize
:
14
),
.
font
:
UIFont
.
PFSCR
(
ofSize
:
14
),
...
@@ -32,15 +34,18 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
...
@@ -32,15 +34,18 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
let
questionAttrStr
=
NSMutableAttributedString
(
string
:
str
,
attributes
:
attributes
)
let
questionAttrStr
=
NSMutableAttributedString
(
string
:
str
,
attributes
:
attributes
)
let
starRange
=
NSRange
(
location
:
0
,
length
:
1
)
let
starRange
=
NSRange
(
location
:
0
,
length
:
1
)
questionAttrStr
.
addAttribute
(
NSAttributedString
.
Key
.
foregroundColor
,
value
:
UIColor
(
hex
:
0xFF3A3A
),
range
:
starRange
)
questionAttrStr
.
addAttribute
(
NSAttributedString
.
Key
.
foregroundColor
,
value
:
UIColor
(
hex
:
0xFF3A3A
),
range
:
starRange
)
question
Label
.
attributedText
=
questionAttrStr
title
Label
.
attributedText
=
questionAttrStr
}
}
}
}
}
}
var
selectBlock
:((
Bool
)
->
Void
)?
var
response
:
Bool
=
false
{
didSet
{
showResponse
(
response
)
}
}
lazy
var
question
Label
:
UILabel
=
{
lazy
var
title
Label
:
UILabel
=
{
let
label
=
UILabel
()
let
label
=
UILabel
()
label
.
numberOfLines
=
0
label
.
numberOfLines
=
0
label
.
textColor
=
UIColor
(
hexString
:
"#333333"
)
label
.
textColor
=
UIColor
(
hexString
:
"#333333"
)
...
@@ -84,14 +89,14 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
...
@@ -84,14 +89,14 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
self
.
selectionStyle
=
.
none
self
.
selectionStyle
=
.
none
question
=
" 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
title
=
" 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView
.
addSubview
(
question
Label
)
contentView
.
addSubview
(
title
Label
)
contentView
.
addSubview
(
negativeBtn
)
contentView
.
addSubview
(
negativeBtn
)
contentView
.
addSubview
(
confirmBtn
)
contentView
.
addSubview
(
confirmBtn
)
// 默认选择否按钮
// 默认选择否按钮
didClickResponseBtn
(
btn
:
negativeBtn
)
response
=
false
question
Label
.
snp
.
makeConstraints
{
make
in
title
Label
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
contentView
.
snp
.
top
)
.
offset
(
12
)
make
.
top
.
equalTo
(
contentView
.
snp
.
top
)
.
offset
(
12
)
make
.
left
.
equalToSuperview
()
.
offset
(
16
)
make
.
left
.
equalToSuperview
()
.
offset
(
16
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
16
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
16
)
...
@@ -99,8 +104,8 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
...
@@ -99,8 +104,8 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
negativeBtn
.
snp
.
makeConstraints
{
make
in
negativeBtn
.
snp
.
makeConstraints
{
make
in
make
.
size
.
equalTo
(
CGSize
(
width
:
btnWidth
,
height
:
btnHeight
))
make
.
size
.
equalTo
(
CGSize
(
width
:
btnWidth
,
height
:
btnHeight
))
make
.
left
.
equalTo
(
question
Label
)
make
.
left
.
equalTo
(
title
Label
)
make
.
top
.
equalTo
(
question
Label
.
snp
.
bottom
)
.
offset
(
12
)
make
.
top
.
equalTo
(
title
Label
.
snp
.
bottom
)
.
offset
(
12
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
16
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
16
)
}
}
...
@@ -112,12 +117,16 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
...
@@ -112,12 +117,16 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
}
}
@objc
func
didClickResponseBtn
(
btn
:
UIButton
)
{
@objc
func
didClickResponseBtn
(
btn
:
UIButton
)
{
let
isConfirm
=
(
btn
.
tag
==
confirmTag
)
response
=
(
btn
.
tag
==
confirmTag
)
if
let
responseBlock
=
responseBlock
{
responseBlock
(
btn
.
tag
==
confirmTag
)
}
}
func
showResponse
(
_
isConfirm
:
Bool
)
{
confirmBtn
.
layer
.
borderColor
=
(
isConfirm
?
btnTitleSelectColor
:
.
clear
)
.
cgColor
confirmBtn
.
layer
.
borderColor
=
(
isConfirm
?
btnTitleSelectColor
:
.
clear
)
.
cgColor
confirmBtn
.
setTitleColor
((
isConfirm
?
btnTitleSelectColor
:
btnTitleDefaultColor
),
for
:
.
normal
)
confirmBtn
.
setTitleColor
((
isConfirm
?
btnTitleSelectColor
:
btnTitleDefaultColor
),
for
:
.
normal
)
negativeBtn
.
layer
.
borderColor
=
(
isConfirm
?
.
clear
:
btnTitleSelectColor
)
.
cgColor
negativeBtn
.
layer
.
borderColor
=
(
isConfirm
?
.
clear
:
btnTitleSelectColor
)
.
cgColor
negativeBtn
.
setTitleColor
((
isConfirm
?
btnTitleDefaultColor
:
btnTitleSelectColor
),
for
:
.
normal
)
negativeBtn
.
setTitleColor
((
isConfirm
?
btnTitleDefaultColor
:
btnTitleSelectColor
),
for
:
.
normal
)
}
}
}
}
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