Commit be28c1497248833feae814d6d91358a37acca943

Authored by yanglingyu
1 parent 60a32a43

设置和通用cell布局优化

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