Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 65b4ddf

Browse files
部分页面布局适配 iPad
1 parent 75fa5b6 commit 65b4ddf

File tree

4 files changed

+13
-67
lines changed

4 files changed

+13
-67
lines changed

‎Coding_iOS/Coding_iOS-Prefix.pch.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
#define kDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
113113
#define kDevice_Is_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
114114
#define kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
115+
#define kDevice_Is_iPad [[UIDevice currentDevice].model isEqualToString:@"iPad"]
116+
#define kDevice_Use_iPhone4_Layout (kDevice_Is_iPhone4 || kDevice_Is_iPad)
115117

116118
#define kSafeArea_Top (kDevice_Is_iPhoneX? 44: 20)
117119
#define kSafeArea_Bottom (kDevice_Is_iPhoneX? 34: 0)

‎Coding_iOS/Controllers/Login/IntroductionViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ - (void)configureButtonsAndPageControl{
7777
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
7878
make.size.mas_equalTo(CGSizeMake(kScreen_Width, 20));
7979
make.centerX.equalTo(self.view);
80-
make.bottom.equalTo(self.view.mas_bottom).offset(kDevice_Is_iPhone4? -10: kDevice_Is_iPhone5? -30: -(50 + kSafeArea_Bottom));
80+
make.bottom.equalTo(self.view.mas_bottom).offset(kDevice_Use_iPhone4_Layout? -10: kDevice_Is_iPhone5? -30: -(50 + kSafeArea_Bottom));
8181
}];
8282
// Button
8383
self.loginPrivateCloudBtn = ({
@@ -97,7 +97,7 @@ - (void)configureButtonsAndPageControl{
9797
make.left.equalTo(self.view).offset(padding);
9898
make.right.equalTo(self.view).offset(-padding);
9999
make.centerX.equalTo(self.view);
100-
make.bottom.equalTo(_pageControl.mas_top).offset(kDevice_Is_iPhone4? -10: kDevice_Is_iPhone5? -20 : -50);
100+
make.bottom.equalTo(_pageControl.mas_top).offset(kDevice_Use_iPhone4_Layout? -10: kDevice_Is_iPhone5? -20 : -50);
101101
}];
102102

103103
self.loginEnterpriseBtn = ({
@@ -242,13 +242,13 @@ - (instancetype)init{
242242
[self addSubview:_titleL];
243243
[self addSubview:_contentL];
244244
[_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
245-
make.top.equalTo(self).offset(kDevice_Is_iPhone4? 64: 90);
245+
make.top.equalTo(self).offset(kDevice_Use_iPhone4_Layout? 64: 90);
246246
make.left.equalTo(self).offset(30);
247247
make.right.equalTo(self).offset(-30);
248248
}];
249249
[_contentL mas_makeConstraints:^(MASConstraintMaker *make) {
250250
make.left.right.equalTo(_titleL);
251-
make.top.equalTo(_titleL.mas_bottom).offset((kDevice_Is_iPhone4 || kDevice_Is_iPhone5)? 20: 40);
251+
make.top.equalTo(_titleL.mas_bottom).offset((kDevice_Use_iPhone4_Layout || kDevice_Is_iPhone5)? 20: 40);
252252
}];
253253
}
254254
return self;
@@ -363,7 +363,7 @@ - (void)setCurItem:(IntroductionItem *)curItem{
363363
- (NSAttributedString *)attrTitle{
364364
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:_curItem.title];
365365
NSString *colorStr = [_curItem.title componentsSeparatedByString:@"\n"].lastObject;
366-
[attrStr addAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:(kDevice_Is_iPhone4 || kDevice_Is_iPhone5)? 30: 34],
366+
[attrStr addAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:(kDevice_Use_iPhone4_Layout || kDevice_Is_iPhone5)? 30: 34],
367367
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x2AD37D"]}
368368
range:[_curItem.title rangeOfString:colorStr]];
369369
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
@@ -399,7 +399,7 @@ - (instancetype)init{
399399
self.alpha = 0;
400400
_imageV = [YLImageView new];
401401
_titleL = [UILabel labelWithFont:[UIFont systemFontOfSize:21 weight:UIFontWeightMedium] textColor:kColorDark4];
402-
_contentL = [UILabel labelWithFont:[UIFont systemFontOfSize:(kDevice_Is_iPhone4 || kDevice_Is_iPhone5)? 15: 17] textColor:kColorDark4];
402+
_contentL = [UILabel labelWithFont:[UIFont systemFontOfSize:(kDevice_Use_iPhone4_Layout || kDevice_Is_iPhone5)? 15: 17] textColor:kColorDark4];
403403
[self addSubview:_imageV];
404404
[self addSubview:_titleL];
405405
[self addSubview:_contentL];

‎Coding_iOS/Controllers/PointRecordsViewController.m

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -174,62 +174,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
174174
- (void)rightNavBtnClicked{
175175
AboutPointViewController *vc = [AboutPointViewController new];
176176
[self.navigationController pushViewController:vc animated:YES];
177-
178-
//
179-
// CGRect originFrame = CGRectMake(kScreen_Width - 15, 0, 0, 0);
180-
// if (_isShowingTip) {
181-
// [UIView animateWithDuration:0.3 animations:^{
182-
// self.tipContainerV.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
183-
// self.tipBGV.frame = originFrame;
184-
// } completion:^(BOOL finished) {
185-
// [self.tipContainerV removeFromSuperview];
186-
// self.isShowingTip = NO;
187-
// }];
188-
// }else{
189-
// NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
190-
// paragraphStyle.lineSpacing = kDevice_Is_iPhone4? 0: 5;
191-
// if (!_tipContainerV) {
192-
// _tipContainerV = [[UIView alloc] initWithFrame:self.view.bounds];
193-
// }
194-
// if (!_tipBGV) {
195-
// _tipBGV = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"tip_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(20, 15, 20, 30) resizingMode:UIImageResizingModeStretch]];
196-
// _tipBGV.frame = originFrame;
197-
// _tipBGV.clipsToBounds = YES;
198-
// [_tipContainerV addSubview:_tipBGV];
199-
// }
200-
// if (!_tipL) {
201-
// _tipL = [UILabel new];
202-
// _tipL.textColor = kColor222;
203-
// _tipL.font = [UIFont systemFontOfSize:14];
204-
// _tipL.numberOfLines = 0;
205-
// NSString *tipStr =
206-
//@"1. 使用人民币 兑换 (请通过点击账户码币页面的"购买码币",以充值的形式购买码币。码币与人民币的兑换标准是 1 码币= 50 元人民币(0.1 码币起购买),支持支付宝及微信付款)\n\
207-
//2. 冒泡 被管理员推荐上广场 奖励 0.01\n\
208-
//3. 邀请好友 注册 Coding 并绑定手机号 奖励 0.02mb\n\
209-
//4. 过生日赠送 0.1mb\n\
210-
//5. 完善 个人信息 奖励 0.1mb\n\
211-
//6. 完成 手机验证 奖励 0.1mb\n\
212-
//7. 开启 两步验证 奖励 0.1mb\n\
213-
//8. App 首次登录 奖励 0.1mb\n\
214-
//9. 我们不定期发布的其他形式的码币悬赏活动(请关注 Coding冒泡,Coding微博 及 Coding微信公众号),数量不等\n\
215-
//10. 转发 Coding微博,每周抽 1 名转发用户赠送 0.5mb\n\
216-
//11. 给 Coding 博客 投稿 奖励 1-2mb";
217-
// NSMutableAttributedString *tipAttrStr = [[NSMutableAttributedString alloc] initWithString:tipStr];
218-
// [tipAttrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, tipStr.length)];
219-
// _tipL.attributedText = tipAttrStr;
220-
// _tipL.frame = CGRectMake(15, 40, kScreen_Width - 15 * 4, 0);
221-
// [_tipBGV addSubview:_tipL];
222-
// }
223-
// CGFloat textHeight = [_tipL.text boundingRectWithSize:CGSizeMake(kScreen_Width - 15 * 4, CGFLOAT_MAX) options:(NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSParagraphStyleAttributeName: paragraphStyle, NSFontAttributeName: _tipL.font} context:nil].size.height;
224-
// _tipL.height = textHeight;
225-
// [self.view addSubview:self.tipContainerV];
226-
// [UIView animateWithDuration:0.3 animations:^{
227-
// self.tipContainerV.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
228-
// self.tipBGV.frame = CGRectMake(15, 0, kScreen_Width - 15 * 2, textHeight + 40 + 30);
229-
// } completion:^(BOOL finished) {
230-
// self.isShowingTip = YES;
231-
// }];
232-
// }
233177
}
234178

235179
@end

‎Coding_iOS/Util/Manager/FunctionIntroManager.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ - (EAIntroPage *)p_pageWithIndex:(NSInteger)index{
159159
UIButton *button = [self p_useImmediatelyButton];
160160
[imageView addSubview:button];
161161
[button mas_makeConstraints:^(MASConstraintMaker *make) {
162-
make.size.mas_equalTo(CGSizeMake(200, (kDevice_Is_iPhone4 || kDevice_Is_iPhone5)? 50: 55));
162+
make.size.mas_equalTo(CGSizeMake(200, (kDevice_Use_iPhone4_Layout || kDevice_Is_iPhone5)? 50: 55));
163163
make.centerX.equalTo(imageView);
164-
make.bottom.equalTo(imageView).offset(kDevice_Is_iPhone4? -40: kDevice_Is_iPhone5? -65: kDevice_Is_iPhone6? -70: kDevice_Is_iPhone6Plus? -90: -120);
164+
make.bottom.equalTo(imageView).offset(kDevice_Use_iPhone4_Layout? -40: kDevice_Is_iPhone5? -65: kDevice_Is_iPhone6? -70: kDevice_Is_iPhone6Plus? -90: -120);
165165
}];
166166
}
167167
}
@@ -171,13 +171,13 @@ - (EAIntroPage *)p_pageWithIndex:(NSInteger)index{
171171

172172
#pragma mark EAIntroDelegate
173173
- (void)intro:(EAIntroView *)introView pageStartScrolling:(EAIntroPage *)page withIndex:(NSUInteger)pageIndex{
174-
introView.pageControl.hidden = (pageIndex >= kIntroPageNum - 2 && kDevice_Is_iPhone4);
174+
introView.pageControl.hidden = (pageIndex >= kIntroPageNum - 2 && kDevice_Use_iPhone4_Layout);
175175
}
176176
- (void)intro:(EAIntroView *)introView pageAppeared:(EAIntroPage *)page withIndex:(NSUInteger)pageIndex{
177-
introView.pageControl.hidden = (pageIndex == kIntroPageNum - 1 && kDevice_Is_iPhone4);
177+
introView.pageControl.hidden = (pageIndex == kIntroPageNum - 1 && kDevice_Use_iPhone4_Layout);
178178
}
179179
- (void)intro:(EAIntroView *)introView pageEndScrolling:(EAIntroPage *)page withIndex:(NSUInteger)pageIndex{
180-
introView.pageControl.hidden = (pageIndex == kIntroPageNum - 1 && kDevice_Is_iPhone4);
180+
introView.pageControl.hidden = (pageIndex == kIntroPageNum - 1 && kDevice_Use_iPhone4_Layout);
181181
}
182182

183183
@end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /