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
c71082dc
Commit
c71082dc
authored
Sep 02, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扩展fix属性
parent
7febf421
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
CGFloat+Extention.swift
...xy/galaxy/Classes/Tools/Extention/CGFloat+Extention.swift
+37
-0
No files found.
galaxy/galaxy/Classes/Tools/Extention/CGFloat+Extention.swift
View file @
c71082dc
...
@@ -29,3 +29,40 @@ extension CGFloat {
...
@@ -29,3 +29,40 @@ extension CGFloat {
return
self
*
scale
return
self
*
scale
}
}
}
}
extension
Int
{
var
fix
:
CGFloat
{
let
screenWidth
=
UIScreen
.
main
.
bounds
.
width
// 假设设计稿基于375pt宽度,iPhone 6的屏幕宽度
let
baseWidth
:
CGFloat
=
375.0
// 计算换算比例
let
scale
=
screenWidth
/
baseWidth
// 应用换算比例
return
CGFloat
(
self
)
*
scale
}
}
extension
Float
{
var
fix
:
CGFloat
{
let
screenWidth
=
UIScreen
.
main
.
bounds
.
width
// 假设设计稿基于375pt宽度,iPhone 6的屏幕宽度
let
baseWidth
:
CGFloat
=
375.0
// 计算换算比例
let
scale
=
screenWidth
/
baseWidth
// 应用换算比例
return
CGFloat
(
self
)
*
scale
}
}
extension
Double
{
var
fix
:
CGFloat
{
let
screenWidth
=
UIScreen
.
main
.
bounds
.
width
// 假设设计稿基于375pt宽度,iPhone 6的屏幕宽度
let
baseWidth
:
CGFloat
=
375.0
// 计算换算比例
let
scale
=
screenWidth
/
baseWidth
// 应用换算比例
return
CGFloat
(
self
)
*
scale
}
}
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