Commit 495fe4f0 authored by David黄金龙's avatar David黄金龙

处理模拟器上能运行 版本

parent cc926991
...@@ -224,6 +224,11 @@ extension YHOneKeyLoginManager { ...@@ -224,6 +224,11 @@ extension YHOneKeyLoginManager {
} }
} }
func isRunningOnSimulator() -> Bool {
return ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"] != nil
}
func createLoginUIModel() -> TXCustomModel { func createLoginUIModel() -> TXCustomModel {
let model = TXCustomModel() let model = TXCustomModel()
...@@ -336,7 +341,7 @@ extension YHOneKeyLoginManager { ...@@ -336,7 +341,7 @@ extension YHOneKeyLoginManager {
let alertBtnWith = alertWidth-16.0*2 let alertBtnWith = alertWidth-16.0*2
let alertBtnHeight = 45.0 let alertBtnHeight = 45.0
var currentTop = 0.0 var currentTop : CGFloat = 0.0
model.privacyAlertTitleFrameBlock = { model.privacyAlertTitleFrameBlock = {
screenSize, superViewSize, frame in screenSize, superViewSize, frame in
return CGRectMake(0, 15, frame.size.width, titleHeight) return CGRectMake(0, 15, frame.size.width, titleHeight)
...@@ -350,18 +355,26 @@ extension YHOneKeyLoginManager { ...@@ -350,18 +355,26 @@ extension YHOneKeyLoginManager {
attributes: attributes, attributes: attributes,
context: nil context: nil
).size ).size
let textHeight = ceill(boundingSize.height) let textHeight = ceill(Float80(boundingSize.height))
model.privacyAlertPrivacyContentFrameBlock = { model.privacyAlertPrivacyContentFrameBlock = {
screenSize, superViewSize, frame in screenSize, superViewSize, frame in
return CGRectMake(21.0, 15+24+33, alertContentWidth, textHeight) return CGRectMake(21.0, 15.0+24.0+33.0, alertContentWidth, CGFloat(textHeight))
} }
currentTop += 33+textHeight currentTop = currentTop + 33.0 + Double(textHeight)
#if targetEnvironment(simulator)
// 这段代码只会在模拟器上编译
print("This is running on a simulator.")
#else
// 这段代码只会在真机上编译
print("This is running on a physical device.")
model.privacyAlertButtonFrameBlock = { model.privacyAlertButtonFrameBlock = {
screenSize, superViewSize, frame in screenSize, superViewSize, frame in
return CGRectMake(16, 15+24+33+textHeight+36.0, alertBtnWith, alertBtnHeight) return CGRectMake(16, 15+24+33+textHeight+36.0, alertBtnWith, alertBtnHeight)
} }
#endif
currentTop += 36.0+alertBtnHeight currentTop += 36.0+alertBtnHeight
let totalHeight = currentTop + 16.0 let totalHeight = currentTop + 16.0
model.privacyAlertFrameBlock = { model.privacyAlertFrameBlock = {
......
...@@ -301,8 +301,8 @@ class YHAddFriendCardCell: UITableViewCell { ...@@ -301,8 +301,8 @@ class YHAddFriendCardCell: UITableViewCell {
attributes: attributes, attributes: attributes,
context: nil context: nil
).size ).size
let textHeight = ceill(boundingSize.height) let textHeight = ceill(Float80(boundingSize.height))
return textHeight return CGFloat(textHeight)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment