Skip to content

Commit 3a62c08

Browse files
committed
About排版,URL打开
1 parent 4a22ede commit 3a62c08

3 files changed

Lines changed: 91 additions & 28 deletions

File tree

Coding_iOS/AppDelegate.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ - (void)customizeInterface {
211211
[navigationBarAppearance setTitleTextAttributes:textAttributes];
212212
}
213213

214+
#pragma mark URL Schemes
215+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
216+
return YES;
217+
}
214218

215219
#pragma mark - Methods Core Data
216220

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,16 @@
3838
</array>
3939
<key>UIViewControllerBasedStatusBarAppearance</key>
4040
<false/>
41+
<key>CFBundleURLTypes</key>
42+
<array>
43+
<dict>
44+
<key>CFBundleURLName</key>
45+
<string>net.coding.CodingForiOS</string>
46+
<key>CFBundleURLSchemes</key>
47+
<array>
48+
<string>CodingForiOS</string>
49+
</array>
50+
</dict>
51+
</array>
4152
</dict>
4253
</plist>

Coding_iOS/Controllers/MeSetting/AboutViewController.m

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
//
88

99
#import "AboutViewController.h"
10+
#import <Masonry/Masonry.h>
1011

1112
@interface AboutViewController ()
12-
@property (strong, nonatomic) UIImageView *logoView;
13-
@property (strong, nonatomic) UILabel *logoLabel, *versionLabel, *infoLabel;
1413
@end
1514

1615
@implementation AboutViewController
@@ -42,35 +41,84 @@ - (void)loadView{
4241
self.title = @"关于Coding";
4342
self.view.backgroundColor = [UIColor colorWithHexString:@"0xe5e5e5"];
4443

45-
_logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_about"]];
46-
[_logoView setCenter:CGPointMake(kScreen_Width/2, 36+CGRectGetMidY(_logoView.bounds))];
47-
[self.view addSubview:_logoView];
44+
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_about"]];
45+
[self.view addSubview:logoView];
46+
47+
UILabel *logoLabel = [[UILabel alloc] init];
48+
logoLabel.font = [UIFont boldSystemFontOfSize:17];
49+
logoLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
50+
logoLabel.textAlignment = NSTextAlignmentCenter;
51+
logoLabel.text = @"Coding-让开发更简单";
52+
[self.view addSubview:logoLabel];
53+
54+
UILabel *versionLabel = [[UILabel alloc] init];
55+
versionLabel.font = [UIFont systemFontOfSize:12];
56+
versionLabel.textColor = [UIColor colorWithHexString:@"0x666666"];
57+
versionLabel.textAlignment = NSTextAlignmentCenter;
58+
versionLabel.text = [NSString stringWithFormat:@"版本:V%@", kVersion_Coding];
59+
[self.view addSubview:versionLabel];
4860

49-
_logoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_logoView.frame), kScreen_Width, 30)];
50-
_logoLabel.backgroundColor = [UIColor clearColor];
51-
_logoLabel.font = [UIFont boldSystemFontOfSize:17];
52-
_logoLabel.textColor = [UIColor colorWithHexString:@"0x000000"];
53-
_logoLabel.textAlignment = NSTextAlignmentCenter;
54-
_logoLabel.text = @"coding-让开发更简单";
55-
[self.view addSubview:_logoLabel];
5661

57-
_versionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_logoLabel.frame), kScreen_Width, 20)];
58-
_versionLabel.backgroundColor = [UIColor clearColor];
59-
_versionLabel.font = [UIFont systemFontOfSize:12];
60-
_versionLabel.textColor = [UIColor colorWithHexString:@"0x666666"];
61-
_versionLabel.textAlignment = NSTextAlignmentCenter;
62-
_versionLabel.text = [NSString stringWithFormat:@"版本:V%@", kVersion_Coding];
63-
[self.view addSubview:_versionLabel];
6462

65-
// _infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, kScreen_Height-100, kScreen_Width, 100)];
66-
_infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, kScreen_Height-180, kScreen_Width, 100)];
67-
_infoLabel.numberOfLines = 0;
68-
_infoLabel.backgroundColor = [UIColor clearColor];
69-
_infoLabel.font = [UIFont systemFontOfSize:12];
70-
_infoLabel.textColor = [UIColor colorWithHexString:@"0x222222"];
71-
_infoLabel.textAlignment = NSTextAlignmentLeft;
72-
_infoLabel.text = [NSString stringWithFormat:@"官网:https://coding.net \nE-mail:[email protected] \n微博:Coding \n微信:扣钉Coding"];
73-
[self.view addSubview:_infoLabel];
63+
UILabel *infoLabel1 = [[UILabel alloc] init];
64+
infoLabel1.numberOfLines = 0;
65+
infoLabel1.backgroundColor = [UIColor clearColor];
66+
infoLabel1.font = [UIFont systemFontOfSize:12];
67+
infoLabel1.textColor = [UIColor colorWithHexString:@"0x666666"];
68+
infoLabel1.textAlignment = NSTextAlignmentRight;
69+
infoLabel1.text = [NSString stringWithFormat:@"官网:\nE-mail:\n微博:\n微信:"];
70+
[self.view addSubview:infoLabel1];
71+
72+
UILabel *infoLabel2 = [[UILabel alloc] init];
73+
infoLabel2.numberOfLines = 0;
74+
infoLabel2.backgroundColor = [UIColor clearColor];
75+
infoLabel2.font = [UIFont systemFontOfSize:12];
76+
infoLabel2.textColor = [UIColor colorWithHexString:@"0x666666"];
77+
infoLabel2.textAlignment = NSTextAlignmentLeft;
78+
infoLabel2.text = [NSString stringWithFormat:@"https://coding.net \n[email protected] \nCoding \n扣钉Coding"];
79+
[self.view addSubview:infoLabel2];
80+
7481

82+
UILabel *copyrightLabel = [[UILabel alloc] init];
83+
copyrightLabel.font = [UIFont systemFontOfSize:12];
84+
copyrightLabel.textColor = [UIColor colorWithHexString:@"0x666666"];
85+
copyrightLabel.textAlignment = NSTextAlignmentCenter;
86+
copyrightLabel.text = [NSString stringWithFormat:@"Copyright © 2015 Coding.net"];
87+
[self.view addSubview:copyrightLabel];
88+
89+
[logoView mas_makeConstraints:^(MASConstraintMaker *make) {
90+
make.top.equalTo(self.view.mas_top).offset(40);
91+
make.centerX.equalTo(self.view.mas_centerX);
92+
}];
93+
[logoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
94+
make.top.equalTo(logoView.mas_bottom).offset(15);
95+
make.left.right.equalTo(self.view);
96+
make.height.mas_equalTo(logoLabel.font.pointSize);
97+
}];
98+
[versionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
99+
make.top.equalTo(logoLabel.mas_bottom).offset(20);
100+
make.left.right.equalTo(self.view);
101+
make.height.mas_equalTo(versionLabel.font.pointSize);
102+
}];
103+
104+
[infoLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
105+
make.bottom.equalTo(copyrightLabel.mas_top).offset(-20);
106+
make.left.mas_equalTo(self.view.mas_left);
107+
make.right.equalTo(self.view.mas_centerX).offset(-20);
108+
make.height.mas_equalTo(60);
109+
}];
110+
111+
[infoLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
112+
make.bottom.equalTo(copyrightLabel.mas_top).offset(-20);
113+
make.left.mas_equalTo(infoLabel1.mas_right);
114+
make.right.equalTo(self.view.mas_right);
115+
make.height.mas_equalTo(60);
116+
}];
117+
118+
[copyrightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
119+
make.bottom.equalTo(self.view.mas_bottom).offset(-20);
120+
make.left.right.equalTo(self.view);
121+
make.height.mas_equalTo(20);
122+
}];
75123
}
76124
@end

0 commit comments

Comments
 (0)