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
22eed633
Commit
22eed633
authored
Nov 20, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 自定义textView
parent
705c2e0c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHAutoTextView.swift
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
+65
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
22eed633
...
@@ -172,6 +172,7 @@
...
@@ -172,6 +172,7 @@
0435FA7F2BA178C100024EAE
/* YHCommonAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA7E2BA178C100024EAE
/* YHCommonAlertView.swift */
;
};
0435FA7F2BA178C100024EAE
/* YHCommonAlertView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA7E2BA178C100024EAE
/* YHCommonAlertView.swift */
;
};
0435FA812BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA802BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift */
;
};
0435FA812BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA802BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift */
;
};
0435FA832BA2DEB100024EAE
/* YHCardButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA822BA2DEB100024EAE
/* YHCardButton.swift */
;
};
0435FA832BA2DEB100024EAE
/* YHCardButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0435FA822BA2DEB100024EAE
/* YHCardButton.swift */
;
};
04395F8A2CEDB26500D3005C
/* YHAutoTextView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04395F892CEDB26500D3005C
/* YHAutoTextView.swift */
;
};
043B0A352C1190C6008A9BBA
/* YHSelectFileSheetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043B0A342C1190C6008A9BBA
/* YHSelectFileSheetView.swift */
;
};
043B0A352C1190C6008A9BBA
/* YHSelectFileSheetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043B0A342C1190C6008A9BBA
/* YHSelectFileSheetView.swift */
;
};
043BA8752C241B38006EF02D
/* YHAddFriendCardCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043BA8742C241B38006EF02D
/* YHAddFriendCardCell.swift */
;
};
043BA8752C241B38006EF02D
/* YHAddFriendCardCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043BA8742C241B38006EF02D
/* YHAddFriendCardCell.swift */
;
};
043BA8892C244129006EF02D
/* people_head.json in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043BA8882C244129006EF02D
/* people_head.json */
;
};
043BA8892C244129006EF02D
/* people_head.json in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
043BA8882C244129006EF02D
/* people_head.json */
;
};
...
@@ -1199,6 +1200,7 @@
...
@@ -1199,6 +1200,7 @@
0435FA7E2BA178C100024EAE
/* YHCommonAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCommonAlertView.swift
;
sourceTree
=
"<group>"
;
};
0435FA7E2BA178C100024EAE
/* YHCommonAlertView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCommonAlertView.swift
;
sourceTree
=
"<group>"
;
};
0435FA802BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMyFileMethodTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
0435FA802BA186D600024EAE
/* YHMyFileMethodTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMyFileMethodTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
0435FA822BA2DEB100024EAE
/* YHCardButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCardButton.swift
;
sourceTree
=
"<group>"
;
};
0435FA822BA2DEB100024EAE
/* YHCardButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCardButton.swift
;
sourceTree
=
"<group>"
;
};
04395F892CEDB26500D3005C
/* YHAutoTextView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAutoTextView.swift
;
sourceTree
=
"<group>"
;
};
043B0A342C1190C6008A9BBA
/* YHSelectFileSheetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectFileSheetView.swift
;
sourceTree
=
"<group>"
;
};
043B0A342C1190C6008A9BBA
/* YHSelectFileSheetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectFileSheetView.swift
;
sourceTree
=
"<group>"
;
};
043BA8742C241B38006EF02D
/* YHAddFriendCardCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAddFriendCardCell.swift
;
sourceTree
=
"<group>"
;
};
043BA8742C241B38006EF02D
/* YHAddFriendCardCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAddFriendCardCell.swift
;
sourceTree
=
"<group>"
;
};
043BA8882C244129006EF02D
/* people_head.json */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.json
;
path
=
people_head.json
;
sourceTree
=
"<group>"
;
};
043BA8882C244129006EF02D
/* people_head.json */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.json
;
path
=
people_head.json
;
sourceTree
=
"<group>"
;
};
...
@@ -5205,6 +5207,7 @@
...
@@ -5205,6 +5207,7 @@
0418921E2C91BAAC00B9FB94
/* YHBaseDynamicCornerRadiusView.swift */
,
0418921E2C91BAAC00B9FB94
/* YHBaseDynamicCornerRadiusView.swift */
,
04F243622C9D4C9700DF2C74
/* YHBaseCornerRadiusBorderView.swift */
,
04F243622C9D4C9700DF2C74
/* YHBaseCornerRadiusBorderView.swift */
,
04F2432E2C94704200DF2C74
/* YHPaddedLabel.swift */
,
04F2432E2C94704200DF2C74
/* YHPaddedLabel.swift */
,
04395F892CEDB26500D3005C
/* YHAutoTextView.swift */
,
);
);
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -5808,6 +5811,7 @@
...
@@ -5808,6 +5811,7 @@
044EE24C2C94396E00A2FE3A
/* YHResignCertificatePassportTableViewCell.swift in Sources */
,
044EE24C2C94396E00A2FE3A
/* YHResignCertificatePassportTableViewCell.swift in Sources */
,
04F2435B2C9D140C00DF2C74
/* YHHKRecordsTitleCell.swift in Sources */
,
04F2435B2C9D140C00DF2C74
/* YHHKRecordsTitleCell.swift in Sources */
,
044F393A2CB7772D007CA277
/* YHVisaRenewalGuideRemarkCell.swift in Sources */
,
044F393A2CB7772D007CA277
/* YHVisaRenewalGuideRemarkCell.swift in Sources */
,
04395F8A2CEDB26500D3005C
/* YHAutoTextView.swift in Sources */
,
041892242C91BCF100B9FB94
/* YHResignRoundCellType.swift in Sources */
,
041892242C91BCF100B9FB94
/* YHResignRoundCellType.swift in Sources */
,
04912F7A2CB7A5F400CC3105
/* YHResignHaveAppointedApplicantsInfoCell.swift in Sources */
,
04912F7A2CB7A5F400CC3105
/* YHResignHaveAppointedApplicantsInfoCell.swift in Sources */
,
0430E6722C749E74000511E2
/* YHAdopterBirthViewController.swift in Sources */
,
0430E6722C749E74000511E2
/* YHAdopterBirthViewController.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
0 → 100644
View file @
22eed633
//
// YHAutoTextView.swift
// galaxy
//
// Created by Dufet on 2024/11/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHAutoTextView
:
UITextView
,
UITextViewDelegate
{
override
open
var
text
:
String
!
{
didSet
{
self
.
setNeedsLayout
()
self
.
layoutIfNeeded
()
}
}
var
placeHolder
:
String
=
""
{
didSet
{
placeholderLabel
.
text
=
placeHolder
}
}
let
placeholderLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
translatesAutoresizingMaskIntoConstraints
=
false
label
.
textColor
=
UIColor
.
lightGray
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
15
)
return
label
}()
override
init
(
frame
:
CGRect
,
textContainer
:
NSTextContainer
?)
{
super
.
init
(
frame
:
frame
,
textContainer
:
textContainer
)
delegate
=
self
isScrollEnabled
=
false
// 禁止滚动
translatesAutoresizingMaskIntoConstraints
=
false
clearsOnInsertion
=
true
self
.
addSubview
(
placeholderLabel
)
placeholderLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
5
)
make
.
left
.
equalTo
(
5
)
make
.
right
.
equalTo
(
-
5
)
}
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
// UITextViewDelegate 方法
func
textViewDidChange
(
_
textView
:
UITextView
)
{
// 更新自身的高度
invalidateIntrinsicContentSize
()
placeholderLabel
.
isHidden
=
!
textView
.
text
.
isEmpty
}
override
var
intrinsicContentSize
:
CGSize
{
// 计算内容的尺寸
let
size
=
sizeThatFits
(
CGSize
(
width
:
frame
.
width
,
height
:
.
greatestFiniteMagnitude
))
return
CGSize
(
width
:
size
.
width
,
height
:
size
.
height
)
}
}
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