1
This commit is contained in:
@@ -89,10 +89,10 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
|||||||
|
|
||||||
CGFloat keyboardHeight = KEYBOARDHEIGHT; // 250
|
CGFloat keyboardHeight = KEYBOARDHEIGHT; // 250
|
||||||
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
||||||
|
|
||||||
NSLayoutConstraint *h = [self.view.heightAnchor constraintEqualToConstant:keyboardHeight];
|
NSLayoutConstraint *h = [self.view.heightAnchor constraintEqualToConstant:keyboardHeight];
|
||||||
NSLayoutConstraint *w = [self.view.widthAnchor constraintEqualToConstant:screenWidth];
|
NSLayoutConstraint *w = [self.view.widthAnchor constraintEqualToConstant:screenWidth];
|
||||||
|
|
||||||
h.priority = UILayoutPriorityRequired;
|
h.priority = UILayoutPriorityRequired;
|
||||||
w.priority = UILayoutPriorityRequired;
|
w.priority = UILayoutPriorityRequired;
|
||||||
[NSLayoutConstraint activateConstraints:@[h, w]];
|
[NSLayoutConstraint activateConstraints:@[h, w]];
|
||||||
|
|||||||
@@ -500,11 +500,15 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有左右占位,则把占位宽度设置为字符键宽度的一定倍数,以实现整体居中
|
// 如果有左右占位,则把占位宽度设置为字符键宽度的一定倍数,以实现整体居中;
|
||||||
|
// 同时强约束左右占位宽度相等,避免在某些系统上由于布局冲突导致只压缩一侧,
|
||||||
|
// 出现“左侧有空隙,右侧无空隙”的情况。
|
||||||
if (leftSpacer && rightSpacer) {
|
if (leftSpacer && rightSpacer) {
|
||||||
|
// 1) 左右占位宽度必须相等
|
||||||
[leftSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
[leftSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.equalTo(firstChar).multipliedBy(edgeSpacerMultiplier);
|
make.width.equalTo(rightSpacer);
|
||||||
}];
|
}];
|
||||||
|
// 2) 同时都接近字符键宽度的 edgeSpacerMultiplier 倍数
|
||||||
[rightSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
[rightSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.equalTo(firstChar).multipliedBy(edgeSpacerMultiplier);
|
make.width.equalTo(firstChar).multipliedBy(edgeSpacerMultiplier);
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -276,6 +276,18 @@
|
|||||||
#pragma mark - Network check & alert
|
#pragma mark - Network check & alert
|
||||||
|
|
||||||
- (void)kb_checkNetworkAndShowAlertIfNeeded {
|
- (void)kb_checkNetworkAndShowAlertIfNeeded {
|
||||||
|
// 首次安装且尚未完成首页引导时,不弹“无网络”提示,避免在系统蜂窝数据权限弹窗前就打扰用户
|
||||||
|
static NSString *const kKBHasLaunchedOnce = @"KBHasLaunchedOnce";
|
||||||
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
if (![ud boolForKey:kKBHasLaunchedOnce]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 仅在应用处于前台时提示
|
||||||
|
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus;
|
AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus;
|
||||||
|
|
||||||
// 只有在“明确不可达”时才弹
|
// 只有在“明确不可达”时才弹
|
||||||
|
|||||||
Reference in New Issue
Block a user