Commit be28c1497248833feae814d6d91358a37acca943

Authored by yanglingyu
1 parent 60a32a43

设置和通用cell布局优化

CNLiveCMineModule/Classes/CNCSubMine/View/CNMineSettingCell.m
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 self.detailImg.image = [CNLiveCMineService imageWithMineName:model.image]; 60 self.detailImg.image = [CNLiveCMineService imageWithMineName:model.image];
61 self.detailImg.hidden = YES; 61 self.detailImg.hidden = YES;
62 self.titleLab.font = UIFontCNMake(17); 62 self.titleLab.font = UIFontCNMake(17);
63 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 63 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
64 make.centerY.mas_equalTo(self.contentView); 64 make.centerY.mas_equalTo(self.contentView);
65 make.left.equalTo(self.contentView).offset(10); 65 make.left.equalTo(self.contentView).offset(10);
66 }]; 66 }];
@@ -74,20 +74,20 @@ @@ -74,20 +74,20 @@
74 if (model.image && ![model.image isWhitespaceAndNewlines]) { 74 if (model.image && ![model.image isWhitespaceAndNewlines]) {
75 75
76 self.titleImg.image = [CNLiveCMineService imageWithMineName:model.image]; 76 self.titleImg.image = [CNLiveCMineService imageWithMineName:model.image];
77 - [self.titleImg mas_makeConstraints:^(MASConstraintMaker *make) { 77 + [self.titleImg mas_remakeConstraints:^(MASConstraintMaker *make) {
78 make.centerY.mas_equalTo(self.contentView); 78 make.centerY.mas_equalTo(self.contentView);
79 make.left.equalTo(self.contentView).offset(10); 79 make.left.equalTo(self.contentView).offset(10);
80 make.width.mas_equalTo(12); 80 make.width.mas_equalTo(12);
81 make.height.mas_equalTo(14); 81 make.height.mas_equalTo(14);
82 }]; 82 }];
83 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 83 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
84 make.centerY.mas_equalTo(self.titleImg); 84 make.centerY.mas_equalTo(self.titleImg);
85 make.left.equalTo(self.titleImg.mas_right).offset(10); 85 make.left.equalTo(self.titleImg.mas_right).offset(10);
86 }]; 86 }];
87 87
88 } else { 88 } else {
89 89
90 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 90 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
91 make.centerY.mas_equalTo(self.contentView); 91 make.centerY.mas_equalTo(self.contentView);
92 make.left.equalTo(self.contentView).offset(10); 92 make.left.equalTo(self.contentView).offset(10);
93 }]; 93 }];
@@ -100,7 +100,7 @@ @@ -100,7 +100,7 @@
100 self.notifiSwitch.hidden = YES; 100 self.notifiSwitch.hidden = YES;
101 self.detailLab.hidden = NO; 101 self.detailLab.hidden = NO;
102 self.detailLab.font = UIFontCNMake(15); 102 self.detailLab.font = UIFontCNMake(15);
103 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 103 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
104 make.centerY.mas_equalTo(self.contentView); 104 make.centerY.mas_equalTo(self.contentView);
105 make.left.equalTo(self.contentView).offset(10); 105 make.left.equalTo(self.contentView).offset(10);
106 }]; 106 }];
@@ -116,13 +116,13 @@ @@ -116,13 +116,13 @@
116 } 116 }
117 self.detailLab.text = phoneStr; 117 self.detailLab.text = phoneStr;
118 self.detailLab.font = UIFontCNMake(15); 118 self.detailLab.font = UIFontCNMake(15);
119 - [self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) { 119 + [self.detailLab mas_remakeConstraints:^(MASConstraintMaker *make) {
120 make.centerY.mas_equalTo(self.contentView); 120 make.centerY.mas_equalTo(self.contentView);
121 make.right.equalTo(self.detailImg.mas_left).offset(-13); 121 make.right.equalTo(self.detailImg.mas_left).offset(-13);
122 }]; 122 }];
123 123
124 self.titleImg.image = [CNLiveCMineService imageWithMineName:model.image]; 124 self.titleImg.image = [CNLiveCMineService imageWithMineName:model.image];
125 - [self.titleImg mas_makeConstraints:^(MASConstraintMaker *make) { 125 + [self.titleImg mas_remakeConstraints:^(MASConstraintMaker *make) {
126 make.centerY.mas_equalTo(self.contentView); 126 make.centerY.mas_equalTo(self.contentView);
127 make.right.equalTo(self.detailLab.mas_left).offset(-14); 127 make.right.equalTo(self.detailLab.mas_left).offset(-14);
128 }]; 128 }];
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 131
132 if (model.cellType == SettingCellTypeMessage) { //消息提醒(已废弃) 132 if (model.cellType == SettingCellTypeMessage) { //消息提醒(已废弃)
133 self.titleLab.hidden = NO; 133 self.titleLab.hidden = NO;
134 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 134 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
135 make.centerY.mas_equalTo(self.contentView); 135 make.centerY.mas_equalTo(self.contentView);
136 make.left.equalTo(self.contentView).offset(10); 136 make.left.equalTo(self.contentView).offset(10);
137 }]; 137 }];
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 140
141 [self.contentView addSubview:self.notifiSwitch]; 141 [self.contentView addSubview:self.notifiSwitch];
142 self.detailImg.hidden = YES; 142 self.detailImg.hidden = YES;
143 - [self.notifiSwitch mas_makeConstraints:^(MASConstraintMaker *make) { 143 + [self.notifiSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
144 make.centerY.mas_equalTo(self.contentView); 144 make.centerY.mas_equalTo(self.contentView);
145 make.right.equalTo(self.contentView).offset(-10); 145 make.right.equalTo(self.contentView).offset(-10);
146 make.width.mas_equalTo(47); 146 make.width.mas_equalTo(47);
@@ -152,7 +152,7 @@ @@ -152,7 +152,7 @@
152 152
153 if (model.cellType == SettingCellTypeSee) { //42 是否允许陌生人看生活圈 153 if (model.cellType == SettingCellTypeSee) { //42 是否允许陌生人看生活圈
154 self.titleLab.hidden = NO; 154 self.titleLab.hidden = NO;
155 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 155 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
156 make.centerY.mas_equalTo(self.contentView); 156 make.centerY.mas_equalTo(self.contentView);
157 make.left.equalTo(self.contentView).offset(10); 157 make.left.equalTo(self.contentView).offset(10);
158 }]; 158 }];
@@ -166,7 +166,7 @@ @@ -166,7 +166,7 @@
166 166
167 } 167 }
168 self.detailImg.hidden = YES; 168 self.detailImg.hidden = YES;
169 - [self.notifiSwitch mas_makeConstraints:^(MASConstraintMaker *make) { 169 + [self.notifiSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
170 make.centerY.mas_equalTo(self.contentView); 170 make.centerY.mas_equalTo(self.contentView);
171 make.right.equalTo(self.contentView).offset(-10); 171 make.right.equalTo(self.contentView).offset(-10);
172 make.width.mas_equalTo(47); 172 make.width.mas_equalTo(47);
@@ -184,7 +184,7 @@ @@ -184,7 +184,7 @@
184 self.titleLab.hidden = [model.isHidden isEqualToString:@"1"]; 184 self.titleLab.hidden = [model.isHidden isEqualToString:@"1"];
185 self.notifiSwitch.hidden = [model.isHidden isEqualToString:@"1"];; 185 self.notifiSwitch.hidden = [model.isHidden isEqualToString:@"1"];;
186 186
187 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 187 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
188 make.centerY.mas_equalTo(self.contentView); 188 make.centerY.mas_equalTo(self.contentView);
189 make.left.equalTo(self.contentView).offset(10); 189 make.left.equalTo(self.contentView).offset(10);
190 190
@@ -193,7 +193,7 @@ @@ -193,7 +193,7 @@
193 [self.contentView addSubview:self.notifiSwitch]; 193 [self.contentView addSubview:self.notifiSwitch];
194 194
195 self.detailImg.hidden = YES; 195 self.detailImg.hidden = YES;
196 - [self.notifiSwitch mas_makeConstraints:^(MASConstraintMaker *make) { 196 + [self.notifiSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
197 make.centerY.mas_equalTo(self.contentView); 197 make.centerY.mas_equalTo(self.contentView);
198 make.right.equalTo(self.contentView).offset(-10); 198 make.right.equalTo(self.contentView).offset(-10);
199 make.width.mas_equalTo(47); 199 make.width.mas_equalTo(47);
@@ -213,7 +213,7 @@ @@ -213,7 +213,7 @@
213 self.titleLab.hidden = NO; 213 self.titleLab.hidden = NO;
214 self.notifiSwitch.hidden = YES; 214 self.notifiSwitch.hidden = YES;
215 self.detailImg.hidden = YES; 215 self.detailImg.hidden = YES;
216 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 216 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
217 make.centerY.mas_equalTo(self.contentView); 217 make.centerY.mas_equalTo(self.contentView);
218 make.left.equalTo(self.contentView).offset(10); 218 make.left.equalTo(self.contentView).offset(10);
219 }]; 219 }];
@@ -225,7 +225,7 @@ @@ -225,7 +225,7 @@
225 // NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"]; // 小版本 225 // NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"]; // 小版本
226 self.versionLab.text = TestEnvironment?[NSString stringWithFormat:@"%@ beta",app_build]:app_build; 226 self.versionLab.text = TestEnvironment?[NSString stringWithFormat:@"%@ beta",app_build]:app_build;
227 227
228 - [self.versionLab mas_makeConstraints:^(MASConstraintMaker *make) { 228 + [self.versionLab mas_remakeConstraints:^(MASConstraintMaker *make) {
229 make.centerY.mas_equalTo(self.contentView); 229 make.centerY.mas_equalTo(self.contentView);
230 make.right.equalTo(self.contentView).offset(-12); 230 make.right.equalTo(self.contentView).offset(-12);
231 231
@@ -238,13 +238,13 @@ @@ -238,13 +238,13 @@
238 self.notifiSwitch.hidden = YES; 238 self.notifiSwitch.hidden = YES;
239 self.detailLab.hidden = NO; 239 self.detailLab.hidden = NO;
240 self.detailLab.font = UIFontCNMake(15); 240 self.detailLab.font = UIFontCNMake(15);
241 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 241 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
242 make.centerY.mas_equalTo(self.contentView); 242 make.centerY.mas_equalTo(self.contentView);
243 make.left.equalTo(self.contentView).offset(10); 243 make.left.equalTo(self.contentView).offset(10);
244 }]; 244 }];
245 245
246 self.detailLab.text = ![NSString isEmpty:model.content]?model.content:@"0.0KB"; 246 self.detailLab.text = ![NSString isEmpty:model.content]?model.content:@"0.0KB";
247 - [self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) { 247 + [self.detailLab mas_remakeConstraints:^(MASConstraintMaker *make) {
248 make.centerY.mas_equalTo(self.contentView); 248 make.centerY.mas_equalTo(self.contentView);
249 make.right.equalTo(self.detailImg.mas_left).offset(-13); 249 make.right.equalTo(self.detailImg.mas_left).offset(-13);
250 }]; 250 }];
@@ -255,18 +255,18 @@ @@ -255,18 +255,18 @@
255 self.notifiSwitch.hidden = YES; 255 self.notifiSwitch.hidden = YES;
256 self.versionImg.hidden = NO; 256 self.versionImg.hidden = NO;
257 self.detailLab.hidden = NO; 257 self.detailLab.hidden = NO;
258 - [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { 258 + [self.titleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
259 make.centerY.mas_equalTo(self.contentView); 259 make.centerY.mas_equalTo(self.contentView);
260 make.left.equalTo(self.contentView).offset(10); 260 make.left.equalTo(self.contentView).offset(10);
261 }]; 261 }];
262 NSString *appStoreVersion = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddAppStoreVersionNumber]; 262 NSString *appStoreVersion = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddAppStoreVersionNumber];
263 self.detailLab.text = ![NSString isEmpty:appStoreVersion]?appStoreVersion:@"没有新版本"; 263 self.detailLab.text = ![NSString isEmpty:appStoreVersion]?appStoreVersion:@"没有新版本";
264 self.detailLab.font = UIFontCNMake(15); 264 self.detailLab.font = UIFontCNMake(15);
265 - [self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) { 265 + [self.detailLab mas_remakeConstraints:^(MASConstraintMaker *make) {
266 make.centerY.mas_equalTo(self.contentView); 266 make.centerY.mas_equalTo(self.contentView);
267 make.right.equalTo(self.detailImg.mas_left).offset(-13); 267 make.right.equalTo(self.detailImg.mas_left).offset(-13);
268 }]; 268 }];
269 - [self.versionImg mas_makeConstraints:^(MASConstraintMaker *make) { 269 + [self.versionImg mas_remakeConstraints:^(MASConstraintMaker *make) {
270 make.right.equalTo(self.detailLab.mas_left).offset(-7); 270 make.right.equalTo(self.detailLab.mas_left).offset(-7);
271 make.top.equalTo(self).offset(7); 271 make.top.equalTo(self).offset(7);
272 make.width.height.mas_equalTo(18); 272 make.width.height.mas_equalTo(18);
CNLiveCMineModule/Classes/CNCSubMine/ViewController/CNMineSettingVC.m
@@ -93,6 +93,18 @@ static NSString *settingListCellId = @"settingListCellId"; @@ -93,6 +93,18 @@ static NSString *settingListCellId = @"settingListCellId";
93 [self getSDCacheSize]; 93 [self getSDCacheSize];
94 [self.view addSubview:self.tableView]; 94 [self.view addSubview:self.tableView];
95 [self.view addSubview:self.quitButton]; 95 [self.view addSubview:self.quitButton];
  96 + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  97 + make.left.right.bottom.equalTo(self.view);
  98 + make.top.equalTo(self.view).offset(kNavigationBarHeight);
  99 + make.bottom.equalTo(self.view.mas_bottom).offset(-kVerticalBottomSafeHeight-60);
  100 +
  101 + }];
  102 +
  103 + [self.quitButton mas_makeConstraints:^(MASConstraintMaker *make) {
  104 + make.left.right.equalTo(self.view);
  105 + make.bottom.equalTo(self.view.mas_bottom).offset(-kVerticalBottomSafeHeight);
  106 + make.height.mas_equalTo(60);
  107 + }];
96 } 108 }
97 - (void)viewWillAppear:(BOOL)animated { 109 - (void)viewWillAppear:(BOOL)animated {
98 [super viewWillAppear:animated]; 110 [super viewWillAppear:animated];
@@ -111,22 +123,6 @@ static NSString *settingListCellId = @"settingListCellId"; @@ -111,22 +123,6 @@ static NSString *settingListCellId = @"settingListCellId";
111 { 123 {
112 [self.tableView reloadData]; 124 [self.tableView reloadData];
113 } 125 }
114 -- (void)viewDidLayoutSubviews {  
115 - [super viewDidLayoutSubviews];  
116 - [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {  
117 - make.left.right.bottom.equalTo(self.view);  
118 - make.top.equalTo(self.view).offset(kNavigationBarHeight);  
119 - make.bottom.equalTo(self.view.mas_bottom).offset(-kVerticalBottomSafeHeight-60);  
120 -  
121 - }];  
122 -  
123 - [self.quitButton mas_makeConstraints:^(MASConstraintMaker *make) {  
124 - make.left.right.equalTo(self.view);  
125 - make.bottom.equalTo(self.view.mas_bottom).offset(-kVerticalBottomSafeHeight);  
126 - make.height.mas_equalTo(60);  
127 - }];  
128 -  
129 -}  
130 #pragma mark - Action 126 #pragma mark - Action
131 - (void)quitAction:(UIButton *)sender { 127 - (void)quitAction:(UIButton *)sender {
132 128