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
776ab150
Commit
776ab150
authored
Jan 05, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 删除无用组件
parent
83b85986
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
478 deletions
+0
-478
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+0
-12
YHSMSCodeInputView.h
...y/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeInputView.h
+0
-34
YHSMSCodeInputView.m
...y/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeInputView.m
+0
-258
YHSMSCodeView.h
...galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeView.h
+0
-23
YHSMSCodeView.m
...galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeView.m
+0
-149
galaxy-Bridge-Header.h
galaxy/galaxy/Res/galaxy-Bridge-Header.h
+0
-2
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
776ab150
...
...
@@ -21,8 +21,6 @@
A5ACE9272B4564F7002C94D2
/* YHLoginViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8DB2B4564F7002C94D2
/* YHLoginViewController.swift */
;
};
A5ACE9282B4564F7002C94D2
/* YHSmsCodeView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8DE2B4564F7002C94D2
/* YHSmsCodeView.swift */
;
};
A5ACE9292B4564F7002C94D2
/* YHSmsCodeInputView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E02B4564F7002C94D2
/* YHSmsCodeInputView.swift */
;
};
A5ACE92A2B4564F7002C94D2
/* YHSMSCodeInputView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E22B4564F7002C94D2
/* YHSMSCodeInputView.m */
;
};
A5ACE92B2B4564F7002C94D2
/* YHSMSCodeView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E32B4564F7002C94D2
/* YHSMSCodeView.m */
;
};
A5ACE92C2B4564F7002C94D2
/* YHLoginStyleButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E42B4564F7002C94D2
/* YHLoginStyleButton.swift */
;
};
A5ACE92D2B4564F7002C94D2
/* YHLoginPrivacyView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E52B4564F7002C94D2
/* YHLoginPrivacyView.swift */
;
};
A5ACE92E2B4564F7002C94D2
/* YHValidateCodeInputView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E62B4564F7002C94D2
/* YHValidateCodeInputView.swift */
;
};
...
...
@@ -121,11 +119,7 @@
A58951C42B398D1000225C19
/* Launch Screen.storyboard */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.storyboard
;
path
=
"Launch Screen.storyboard"
;
sourceTree
=
"<group>"
;
};
A5ACE8DB2B4564F7002C94D2
/* YHLoginViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHLoginViewController.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8DE2B4564F7002C94D2
/* YHSmsCodeView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSmsCodeView.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8DF2B4564F7002C94D2
/* YHSMSCodeInputView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YHSMSCodeInputView.h
;
sourceTree
=
"<group>"
;
};
A5ACE8E02B4564F7002C94D2
/* YHSmsCodeInputView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSmsCodeInputView.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8E12B4564F7002C94D2
/* YHSMSCodeView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YHSMSCodeView.h
;
sourceTree
=
"<group>"
;
};
A5ACE8E22B4564F7002C94D2
/* YHSMSCodeInputView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YHSMSCodeInputView.m
;
sourceTree
=
"<group>"
;
};
A5ACE8E32B4564F7002C94D2
/* YHSMSCodeView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YHSMSCodeView.m
;
sourceTree
=
"<group>"
;
};
A5ACE8E42B4564F7002C94D2
/* YHLoginStyleButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHLoginStyleButton.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8E52B4564F7002C94D2
/* YHLoginPrivacyView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHLoginPrivacyView.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8E62B4564F7002C94D2
/* YHValidateCodeInputView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHValidateCodeInputView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -338,11 +332,7 @@
isa
=
PBXGroup
;
children
=
(
A5ACE8DE2B4564F7002C94D2
/* YHSmsCodeView.swift */
,
A5ACE8DF2B4564F7002C94D2
/* YHSMSCodeInputView.h */
,
A5ACE8E02B4564F7002C94D2
/* YHSmsCodeInputView.swift */
,
A5ACE8E12B4564F7002C94D2
/* YHSMSCodeView.h */
,
A5ACE8E22B4564F7002C94D2
/* YHSMSCodeInputView.m */
,
A5ACE8E32B4564F7002C94D2
/* YHSMSCodeView.m */
,
);
path
=
"验证码输入框"
;
sourceTree
=
"<group>"
;
...
...
@@ -766,7 +756,6 @@
A5ACE9292B4564F7002C94D2
/* YHSmsCodeInputView.swift in Sources */
,
A5ACE9452B4564F7002C94D2
/* BsHUDContainerView.swift in Sources */
,
A5ACE93A2B4564F7002C94D2
/* NSAttributedString+Extension.swift in Sources */
,
A5ACE92A2B4564F7002C94D2
/* YHSMSCodeInputView.m in Sources */
,
A5ACE9512B4564F7002C94D2
/* YhConstant.swift in Sources */
,
A5ACE94A2B4564F7002C94D2
/* BsHUDProgressView.swift in Sources */
,
A5ACE9442B4564F7002C94D2
/* Array+Extension.swift in Sources */
,
...
...
@@ -785,7 +774,6 @@
A5ACE9412B4564F7002C94D2
/* Dictionary+Extension.swift in Sources */
,
A5ACE9312B4564F7002C94D2
/* YHPersonalCenterCell.swift in Sources */
,
A5ACE9532B4564F7002C94D2
/* YHBaseViewController.swift in Sources */
,
A5ACE92B2B4564F7002C94D2
/* YHSMSCodeView.m in Sources */
,
A5ACE9392B4564F7002C94D2
/* UIDevice+Extension.swift in Sources */
,
A5ACE9422B4564F7002C94D2
/* AppDelegate+Extension.swift in Sources */
,
A5ACE93E2B4564F7002C94D2
/* UIImage+Extension.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeInputView.h
deleted
100755 → 0
View file @
83b85986
//
// BsSMSCodeInputView.h
// ObjectiveCTools
//
// Created by aidong on 2020/10/13.
// Copyright © 2020 姬友大人. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
YHSMSCodeInputView
:
UIView
///验证码文字
@property
(
strong
,
nonatomic
)
NSString
*
codeText
;
///设置验证码位数 默认 4 位
@property
(
nonatomic
)
NSInteger
codeCount
;
///验证码数字之间的间距 默认 35
@property
(
nonatomic
)
CGFloat
codeSpace
;
@property
(
nonatomic
,
weak
)
id
myDelegate
;
@end
@protocol
BsSMSCodeInputViewDelegate
<
NSObject
>
@optional
-
(
void
)
textFieldFinisedInput
:
(
YHSMSCodeInputView
*
)
input
verifyCode
:
(
NSString
*
)
code
;
@end
NS_ASSUME_NONNULL_END
galaxy/galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeInputView.m
deleted
100755 → 0
View file @
83b85986
//
// BsSMSCodeInputView.m
// ObjectiveCTools
//
// Created by aidong on 2020/10/13.
// Copyright © 2020 姬友大人. All rights reserved.
//
#import "YHSMSCodeInputView.h"
#import "YHSMSCodeView.h"
@interface
YHSMSCodeInputView
()
<
UITextFieldDelegate
>
///输入框
@property
(
strong
,
nonatomic
)
UITextField
*
textField
;
///格子数组
@property
(
nonatomic
,
strong
)
NSMutableArray
<
YHSMSCodeView
*>
*
arrayTextFidld
;
///记录上一次的字符串
@property
(
strong
,
nonatomic
)
NSString
*
lastString
;
///放置小格子
@property
(
strong
,
nonatomic
)
UIView
*
contentView
;
@end
@implementation
YHSMSCodeInputView
-
(
instancetype
)
init
{
if
(
self
=
[
super
init
])
{
[
self
config
];
}
return
self
;
}
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
[
self
config
];
}
return
self
;
}
-
(
void
)
config
{
_codeCount
=
6
;
//在初始化函数里面, 如果重写了某个属性的setter方法, 那么使用 self.codeCount 会直接调用重写的 setter 方法, 会造成惊喜!
_codeSpace
=
10
;
//初始化数组
_arrayTextFidld
=
[
NSMutableArray
array
];
_lastString
=
@""
;
//输入框
_textField
=
[[
UITextField
alloc
]
init
];
_textField
.
keyboardType
=
UIKeyboardTypeNumberPad
;
_textField
.
textColor
=
UIColor
.
clearColor
;
_textField
.
tintColor
=
UIColor
.
clearColor
;
_textField
.
delegate
=
self
;
[
self
addSubview
:
_textField
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
textFieldDidChangeValue
:
)
name
:
UITextFieldTextDidChangeNotification
object
:
_textField
];
//放置View
_contentView
=
[[
UIView
alloc
]
init
];
_contentView
.
backgroundColor
=
UIColor
.
clearColor
;
_contentView
.
userInteractionEnabled
=
NO
;
[
self
addSubview
:
_contentView
];
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
[
self
updateSubViews
];
}
-
(
void
)
updateSubViews
{
self
.
textField
.
frame
=
self
.
bounds
;
self
.
contentView
.
frame
=
self
.
bounds
;
// self.contentView.backgroundColor = UIColor.purpleColor;
/*
方案1: 直接把原来的都删掉, 重新创建
for (BsSMSCodeView *v in [self.arrayTextFidld reverseObjectEnumerator]) {
[v removeFromSuperview];
[self.arrayTextFidld removeObject:v];
}
*/
//方案2:能用就用,少了再建
if
(
_arrayTextFidld
.
count
<
_codeCount
)
{
//已经存在的子控件比新来的数要小, 那么就创建
NSUInteger
c
=
_codeCount
-
_arrayTextFidld
.
count
;
for
(
NSInteger
i
=
0
;
i
<
c
;
i
++
)
{
YHSMSCodeView
*
v
=
[[
YHSMSCodeView
alloc
]
init
];
[
_arrayTextFidld
addObject
:
v
];
}
}
else
if
(
_arrayTextFidld
.
count
==
_codeCount
)
{
//个数相等
return
;
//如果return,那么就是什么都不做, 如果不return, 那么后续可以更新颜色之类, 或者在转屏的时候重新布局
}
else
if
(
_arrayTextFidld
.
count
>
_codeCount
)
{
//个数有多余, 那么不用创建新的, 为了尽可能释放内存, 把不用的移除掉,
NSUInteger
c
=
_arrayTextFidld
.
count
-
_codeCount
;
for
(
NSInteger
i
=
0
;
i
<
c
;
i
++
)
{
[
_arrayTextFidld
.
lastObject
removeFromSuperview
];
[
_arrayTextFidld
removeLastObject
];
}
}
//可用宽度 / 格子总数
CGFloat
w
=
(
self
.
bounds
.
size
.
width
-
_codeSpace
*
(
_codeCount
-
1
))
/
_codeCount
;
//重新布局小格子
for
(
NSInteger
i
=
0
;
i
<
_arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
t
=
_arrayTextFidld
[
i
];
[
self
.
contentView
addSubview
:
t
];
t
.
frame
=
CGRectMake
(
i
*
(
w
+
_codeSpace
),
0
,
w
,
self
.
bounds
.
size
.
height
);
}
}
//已经编辑
-
(
void
)
textFieldDidChangeValue
:
(
NSNotification
*
)
notification
{
UITextField
*
sender
=
(
UITextField
*
)[
notification
object
];
/*
bug: NSUInteger.
sender.text.length 返回值是 NSUInteger,无符号整型, 当两个无符号整型做减法, 如果 6 - 9, 那么不会得到 -3, 而是一串很长的整型数, 也就是计算失误
*/
BOOL
a
=
sender
.
text
.
length
>=
self
.
lastString
.
length
;
BOOL
b
=
sender
.
text
.
length
-
self
.
lastString
.
length
>=
_codeCount
;
if
(
a
&&
b
)
{
//判断为一连串验证码输入, 那么,最后N个,就是来自键盘上的短信验证码,取最后N个
NSLog
(
@"一连串的输入"
);
sender
.
text
=
[
sender
.
text
substringFromIndex
:
sender
.
text
.
length
-
_codeCount
];
}
if
(
sender
.
text
.
length
>=
_codeCount
+
1
)
{
//对于持续输入,只要前面N个就行
NSLog
(
@"持续输入"
);
sender
.
text
=
[
sender
.
text
substringToIndex
:
_codeCount
-
1
];
}
//字符串转数组
NSMutableArray
<
NSString
*>
*
stringArray
=
[
NSMutableArray
array
];
NSString
*
temp
=
nil
;
for
(
int
i
=
0
;
i
<
[
sender
.
text
length
];
i
++
)
{
temp
=
[
sender
.
text
substringWithRange
:
NSMakeRange
(
i
,
1
)];
[
stringArray
addObject
:
temp
];
}
//设置文字
for
(
int
i
=
0
;
i
<
self
.
arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
BsSMSCodeView
=
self
.
arrayTextFidld
[
i
];
if
(
i
<
stringArray
.
count
)
{
BsSMSCodeView
.
text
=
stringArray
[
i
];
}
else
{
BsSMSCodeView
.
text
=
@""
;
}
}
//设置光标
if
(
stringArray
.
count
==
0
)
{
for
(
int
i
=
0
;
i
<
self
.
arrayTextFidld
.
count
;
i
++
)
{
BOOL
show
=
(
i
==
0
?
YES
:
NO
);
YHSMSCodeView
*
BsSMSCodeView
=
self
.
arrayTextFidld
[
i
];
BsSMSCodeView
.
showCursor
=
show
;
}
}
else
if
(
stringArray
.
count
==
self
.
arrayTextFidld
.
count
)
{
for
(
int
i
=
0
;
i
<
self
.
arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
BsSMSCodeView
=
self
.
arrayTextFidld
[
i
];
BsSMSCodeView
.
showCursor
=
NO
;
}
}
else
{
for
(
int
i
=
0
;
i
<
self
.
arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
BsSMSCodeView
=
self
.
arrayTextFidld
[
i
];
if
(
i
==
stringArray
.
count
)
{
BsSMSCodeView
.
showCursor
=
YES
;
}
else
{
BsSMSCodeView
.
showCursor
=
NO
;
}
}
}
if
(
stringArray
.
count
==
self
.
arrayTextFidld
.
count
)
{
[
self
.
textField
resignFirstResponder
];
//输入完毕 回调出去
if
(
self
.
myDelegate
&&
[
self
.
myDelegate
respondsToSelector
:
@selector
(
textFieldFinisedInput
:
verifyCode
:
)])
{
[
self
.
myDelegate
textFieldFinisedInput
:
self
verifyCode
:
self
.
codeText
];
}
}
self
.
lastString
=
sender
.
text
;
}
-
(
void
)
textFieldDidBeginEditing
:
(
UITextField
*
)
textField
{
//检查上一次的字符串
if
(
self
.
lastString
.
length
==
0
||
self
.
lastString
.
length
==
1
)
{
self
.
arrayTextFidld
.
firstObject
.
showCursor
=
YES
;
}
else
if
(
self
.
lastString
.
length
==
self
.
arrayTextFidld
.
count
)
{
self
.
arrayTextFidld
.
lastObject
.
showCursor
=
YES
;
}
else
{
self
.
arrayTextFidld
[
self
.
lastString
.
length
-
1
].
showCursor
=
YES
;
}
}
-
(
NSString
*
)
codeText
{
return
self
.
textField
.
text
;
}
-
(
BOOL
)
resignFirstResponder
{
for
(
int
i
=
0
;
i
<
self
.
arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
BsSMSCodeView
=
self
.
arrayTextFidld
[
i
];
BsSMSCodeView
.
showCursor
=
NO
;
}
[
self
.
textField
resignFirstResponder
];
return
YES
;
}
-
(
BOOL
)
becomeFirstResponder
{
[
self
.
textField
becomeFirstResponder
];
return
YES
;
}
///如果要求可以随时更改输入位数, 那么,
-
(
void
)
setCodeCount
:
(
NSInteger
)
codeCount
{
_codeCount
=
codeCount
;
//因为个数改变,清空之前输入的内容
self
.
lastString
=
@""
;
self
.
textField
.
text
=
@""
;
for
(
NSInteger
i
=
0
;
i
<
_arrayTextFidld
.
count
;
i
++
)
{
YHSMSCodeView
*
t
=
_arrayTextFidld
[
i
];
t
.
text
=
@""
;
if
(
i
==
0
)
{
t
.
showCursor
=
YES
;
}
else
{
t
.
showCursor
=
NO
;
}
}
[
self
setNeedsLayout
];
[
self
layoutIfNeeded
];
}
//
-
(
BOOL
)
textField
:
(
UITextField
*
)
textField
shouldChangeCharactersInRange
:
(
NSRange
)
range
replacementString
:
(
NSString
*
)
string
{
if
([
string
isEqual
:
@""
])
{
return
true
;
}
if
(
textField
.
text
.
length
>=
_codeCount
)
{
return
false
;
}
return
true
;
}
@end
galaxy/galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeView.h
deleted
100755 → 0
View file @
83b85986
//
// BsSMSCodeView.h
// ObjectiveCTools
//
// Created by aidong on 2020/10/13.
// Copyright © 2020 姬友大人. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
YHSMSCodeView
:
UIView
///文字
@property
(
nonatomic
,
strong
)
NSString
*
text
;
///显示光标 默认关闭
@property
(
nonatomic
)
BOOL
showCursor
;
@end
NS_ASSUME_NONNULL_END
galaxy/galaxy/Classes/Modules/Login(登录)/V/验证码输入框/YHSMSCodeView.m
deleted
100755 → 0
View file @
83b85986
//
// BsSMSCodeView.m
// ObjectiveCTools
//
// Created by aidong on 2020/10/13.
// Copyright © 2020 姬友大人. All rights reserved.
//
#import "YHSMSCodeView.h"
@interface
YHSMSCodeView
()
@property
(
nonatomic
,
strong
)
UILabel
*
label
;
@property
(
nonatomic
,
strong
)
UIView
*
line
;
@property
(
nonatomic
,
strong
)
UIView
*
cursor
;
@property
(
nonatomic
,
strong
)
UIColor
*
mainColor
;
@end
@implementation
YHSMSCodeView
-
(
instancetype
)
init
{
self
=
[
super
init
];
if
(
self
)
{
[
self
config
];
}
return
self
;
}
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
[
self
config
];
}
return
self
;
}
-
(
void
)
config
{
self
.
userInteractionEnabled
=
NO
;
_line
=
[[
UIView
alloc
]
init
];
_line
.
userInteractionEnabled
=
NO
;
_line
.
backgroundColor
=
UIColor
.
blackColor
;
_line
.
hidden
=
YES
;
[
self
addSubview
:
_line
];
_label
=
[[
UILabel
alloc
]
init
];
_label
.
textColor
=
UIColor
.
whiteColor
;
_label
.
font
=
[
UIFont
boldSystemFontOfSize
:
20
];
[
self
addSubview
:
_label
];
//默认关闭
_showCursor
=
NO
;
self
.
layer
.
cornerRadius
=
6
;
self
.
clipsToBounds
=
YES
;
self
.
backgroundColor
=
[
UIColor
colorWithWhite
:
1
alpha
:
0
.
3
];
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
self
.
line
.
frame
=
CGRectMake
(
0
,
self
.
frame
.
size
.
height
-
1
,
self
.
frame
.
size
.
width
,
1
);
CGFloat
x
=
(
self
.
frame
.
size
.
width
-
self
.
label
.
frame
.
size
.
width
)
/
2
.
0
;
CGFloat
y
=
(
self
.
frame
.
size
.
height
-
self
.
label
.
frame
.
size
.
height
)
/
2
.
0
;
self
.
label
.
frame
=
CGRectMake
(
x
,
y
,
self
.
label
.
frame
.
size
.
width
,
self
.
label
.
frame
.
size
.
height
);
[
self
updateCursorFrame
];
}
-
(
void
)
setText
:
(
NSString
*
)
text
{
_text
=
text
;
if
(
_text
.
length
>
0
)
{
_line
.
backgroundColor
=
UIColor
.
redColor
;
}
else
{
_line
.
backgroundColor
=
UIColor
.
grayColor
;
}
_label
.
text
=
text
;
[
self
.
label
sizeToFit
];
[
self
setNeedsLayout
];
[
self
layoutIfNeeded
];
}
-
(
void
)
updateCursorFrame
{
CGFloat
x
=
0
;
if
(
self
.
label
.
frame
.
size
.
width
<=
0
)
{
x
=
(
self
.
frame
.
size
.
width
-
1
.
6
)
/
2
.
0
;
}
else
{
x
=
CGRectGetMaxX
(
self
.
label
.
frame
);
}
_cursor
.
frame
=
CGRectMake
(
x
,
10
,
1
.
6
,
self
.
frame
.
size
.
height
-
20
);
}
-
(
void
)
setShowCursor
:
(
BOOL
)
showCursor
{
if
(
_showCursor
==
YES
&&
showCursor
==
YES
)
{
//重复开始, 那么,什么也不做
}
else
if
(
_showCursor
==
YES
&&
showCursor
==
NO
)
{
//原来是开始的, 现在要求关闭, 那么,就关闭
[
_cursor
removeFromSuperview
];
}
else
if
(
_showCursor
==
NO
&&
showCursor
==
YES
)
{
//原来是关闭, 现在要求开始, 那么, 开始
_cursor
=
[[
UIView
alloc
]
init
];
_cursor
.
userInteractionEnabled
=
NO
;
_cursor
.
backgroundColor
=
UIColor
.
blackColor
;
[
self
addSubview
:
_cursor
];
[
self
updateCursorFrame
];
_cursor
.
alpha
=
0
;
[
self
animationOne
:
_cursor
];
}
else
if
(
_showCursor
==
NO
&&
showCursor
==
NO
)
{
//重复关闭
[
_cursor
removeFromSuperview
];
}
_showCursor
=
showCursor
;
}
// 光标效果
-
(
void
)
animationOne
:
(
UIView
*
)
aView
{
[
UIView
animateWithDuration
:
0
.
1
delay
:
0
options
:
UIViewAnimationOptionCurveEaseIn
animations
:^
{
aView
.
alpha
=
1
;
}
completion
:^
(
BOOL
finished
)
{
if
(
self
.
showCursor
)
{
[
self
performSelector
:
@selector
(
animationTwo
:)
withObject
:
aView
afterDelay
:
0
.
5
];
}
}];
}
-
(
void
)
animationTwo
:
(
UIView
*
)
aView
{
[
UIView
animateWithDuration
:
0
.
3
delay
:
0
options
:
UIViewAnimationOptionCurveEaseOut
animations
:^
{
aView
.
alpha
=
0
;
}
completion
:^
(
BOOL
finished
)
{
if
(
self
.
showCursor
)
{
[
self
performSelector
:
@selector
(
animationOne
:)
withObject
:
aView
afterDelay
:
0
.
1
];
}
}];
}
#pragma mark - lazy
-
(
UIColor
*
)
mainColor
{
if
(
!
_mainColor
)
{
_mainColor
=
[
UIColor
colorWithRed
:
70
/
255
green
:
224
/
255
.
0
blue
:
187
/
255
.
0
alpha
:
1
.
0
];
}
return
_mainColor
;
}
@end
galaxy/galaxy/Res/galaxy-Bridge-Header.h
View file @
776ab150
...
...
@@ -8,8 +8,6 @@
#ifndef galaxy_Bridge_Header_h
#define galaxy_Bridge_Header_h
#import "YHSMSCodeInputView.h"
#import "YHSMSCodeView.h"
#import <Bugly/Bugly.h>
#import <ATAuthSDK_D/ATAuthSDK.h>
...
...
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