@@ -16,6 +16,7 @@ @interface ValueListViewController ()
16
16
@property (strong , nonatomic ) NSArray *dataList;
17
17
@property (assign , nonatomic ) NSInteger selectedIndex;
18
18
@property (assign , nonatomic ) ValueListType type;
19
+ @property (strong , nonatomic ) UIView *tipView;
19
20
@end
20
21
21
22
@implementation ValueListViewController
@@ -129,28 +130,28 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
129
130
130
131
#pragma mark - Tip
131
132
- (void )showMemberTypeTip {
133
+ if (self.tipView ) {
134
+ [self dismissTipView ];
135
+ return ;
136
+ }
137
+
132
138
NSString *tipStr =
133
139
134
140
@" 项目所有者:拥有对项目的所有权限。\n \
135
141
项目管理员:拥有对项目的部分权限。不能删除,转让项目,不能对其他管理员进行操作。\n \
136
142
普通成员:可以阅读和推送代码。\n \
137
143
受限成员:不能进入与代码相关的页面。\n " ;
138
144
139
- [self showTipStr: tipStr];
145
+ self. tipView = [self showTipStr: tipStr];
140
146
}
141
- - (void )showTipStr : (NSString *)tipStr {
147
+ - (UIView * )showTipStr : (NSString *)tipStr {
142
148
if (tipStr.length <= 0 ) {
143
- return ;
149
+ return nil ;
144
150
}
145
151
UIView *tipV = [[UIView alloc ] initWithFrame: self .view.bounds];
146
152
tipV.backgroundColor = [UIColor colorWithWhite: 0.2 alpha: 0.9 ];
147
153
[tipV bk_whenTapped: ^{
148
- [UIView animateWithDuration: 0.3 animations: ^{
149
- tipV.alpha = 0.0 ;
150
- } completion: ^(BOOL finished) {
151
- [tipV removeFromSuperview ];
152
- self.myTableView .scrollEnabled = YES ;
153
- }];
154
+ [self dismissTipView ];
154
155
}];
155
156
UITextView *textV = [UITextView new ];
156
157
textV.backgroundColor = [UIColor clearColor ];
@@ -181,6 +182,17 @@ - (void)showTipStr:(NSString *)tipStr{
181
182
tipV.alpha = 1.0 ;
182
183
self.myTableView .scrollEnabled = NO ;
183
184
}];
185
+ return tipV;
186
+ }
187
+
188
+ - (void )dismissTipView {
189
+ [UIView animateWithDuration: 0.3 animations: ^{
190
+ self.tipView .alpha = 0.0 ;
191
+ } completion: ^(BOOL finished) {
192
+ [self .tipView removeFromSuperview ];
193
+ self.tipView = nil ;
194
+ self.myTableView .scrollEnabled = YES ;
195
+ }];
184
196
}
185
197
186
198
@end
0 commit comments