Commit 3e133224 authored by zhangguangyi's avatar zhangguangyi

update

parent 58c5ce6e
No preview for this file type
...@@ -90,9 +90,10 @@ ...@@ -90,9 +90,10 @@
{ {
if (!_collectionView) { if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(SCREEN_WIDTH / 4, 60); layout.itemSize = CGSizeMake(SCREEN_WIDTH / 4, 70);
layout.minimumLineSpacing = 0; layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 0; layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(10, 0, 0, 0);
_collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; _collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
_collectionView.delegate = self; _collectionView.delegate = self;
_collectionView.dataSource = self; _collectionView.dataSource = self;
......
...@@ -73,6 +73,9 @@ static NSString * const ZJReminderFooterViewID = @"ZJReminderFooterViewID"; ...@@ -73,6 +73,9 @@ static NSString * const ZJReminderFooterViewID = @"ZJReminderFooterViewID";
if (i == 1) { if (i == 1) {
model.iconUrl = self.model.iconUrl; model.iconUrl = self.model.iconUrl;
} }
if (i == 2) {
model.subName = self.model.name;
}
[self.dataArray addObject:model]; [self.dataArray addObject:model];
} }
......
...@@ -21,6 +21,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -21,6 +21,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
@property(nonatomic,strong)ZJReminderBottom *bottomView; @property(nonatomic,strong)ZJReminderBottom *bottomView;
@property(nonatomic,strong)NSMutableArray *dataArray; @property(nonatomic,strong)NSMutableArray *dataArray;
@property(nonatomic,assign)BOOL isManger; @property(nonatomic,assign)BOOL isManger;
@property(nonatomic,strong)UIBarButtonItem *mangerButtonItem;
@end @end
...@@ -49,7 +50,9 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -49,7 +50,9 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
if (self.model) { if (self.model) {
self.title = self.model.name; self.title = self.model.name;
} }
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"管理" style:UIBarButtonItemStyleDone target:self action:@selector(chooseAction)];
self.mangerButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"管理" style:UIBarButtonItemStyleDone target:self action:@selector(chooseAction)];
// self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:self action:@selector(chooseAction)];
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor]; self.navigationItem.rightBarButtonItem.tintColor = [UIColor blackColor];
[self setupUI]; [self setupUI];
...@@ -73,10 +76,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -73,10 +76,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
self.bottomView = [[ZJReminderBottom alloc] init]; self.bottomView = [[ZJReminderBottom alloc] init];
[self.view addSubview:self.bottomView]; [self.view addSubview:self.bottomView];
CGFloat bottomMargin = IPHONE_X ? (-20 - 39) : -20;
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) { [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(20); make.left.mas_equalTo(20);
make.right.mas_equalTo(-20); make.right.mas_equalTo(-20);
make.bottom.mas_equalTo(-20); make.bottom.mas_equalTo(bottomMargin);
make.height.mas_equalTo(44); make.height.mas_equalTo(44);
}]; }];
...@@ -87,7 +92,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -87,7 +92,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
if (weakSelf.isManger) { if (weakSelf.isManger) {
NSLog(@"删除整个分类"); NSLog(@"删除整个分类");
[weakSelf deleteCategory]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"删除后,好友将收不到此分类下的所有提醒通知,确定要删除吗?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"在想想" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *delete = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[weakSelf deleteCategory];
}];
[alert addAction:cancel];
[alert addAction:delete];
[weakSelf presentViewController:alert animated:YES completion:nil];
}else{ }else{
NSLog(@"添加提醒"); NSLog(@"添加提醒");
ZJReminderCateAddController *vc = [ZJReminderCateAddController new]; ZJReminderCateAddController *vc = [ZJReminderCateAddController new];
...@@ -110,6 +122,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -110,6 +122,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
} failure:^(NSError * _Nonnull error) { } failure:^(NSError * _Nonnull error) {
}]; }];
// NSDictionary *dict = @{@"remindTypeId":@(self.model.id)}; // NSDictionary *dict = @{@"remindTypeId":@(self.model.id)};
// [[TQNetworkTools shared] postWithAction:reminderDeleteCategory parameters:dict success:^(id _Nonnull response) { // [[TQNetworkTools shared] postWithAction:reminderDeleteCategory parameters:dict success:^(id _Nonnull response) {
// if ([response[@"status"] intValue] == 200) { // if ([response[@"status"] intValue] == 200) {
...@@ -124,12 +137,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -124,12 +137,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
-(void)chooseAction -(void)chooseAction
{ {
NSString *name = self.navigationItem.rightBarButtonItem.title; NSString *name = self.mangerButtonItem.title;
if ([name isEqualToString:@"管理"]) { if ([name isEqualToString:@"管理"]) {
self.navigationItem.rightBarButtonItem.title = @"取消"; self.mangerButtonItem.title = @"取消";
[self exchangeChooseState:YES]; [self exchangeChooseState:YES];
}else{ }else{
self.navigationItem.rightBarButtonItem.title = @"管理"; self.mangerButtonItem.title = @"管理";
[self exchangeChooseState:NO]; [self exchangeChooseState:NO];
} }
} }
...@@ -167,6 +180,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -167,6 +180,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
}else{ }else{
[MBProgressHUD showError:[NSString stringWithFormat:@"%@", response[@"msg"]] toView:self.view]; [MBProgressHUD showError:[NSString stringWithFormat:@"%@", response[@"msg"]] toView:self.view];
} }
if (self.dataArray.count) {
self.navigationItem.rightBarButtonItem = self.mangerButtonItem;
}else{
self.navigationItem.rightBarButtonItem = nil;
[self exchangeChooseState:NO];
self.mangerButtonItem.title = @"管理";
}
[self.tableView reloadData]; [self.tableView reloadData];
} failure:^(NSError * _Nonnull error) { } failure:^(NSError * _Nonnull error) {
...@@ -200,7 +221,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID"; ...@@ -200,7 +221,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
ZJReminderMainCell *cell = (ZJReminderMainCell *)sender.superview.superview; ZJReminderMainCell *cell = (ZJReminderMainCell *)sender.superview.superview;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell]; NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
ZJReminder *model = self.dataArray[indexPath.row]; ZJReminder *model = self.dataArray[indexPath.row];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"删除后,好友将收不到此分类下的所有提醒通知,确定要删除吗?" preferredStyle:UIAlertControllerStyleAlert]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"删除后,好友将收不到此提醒通知,确定要删除吗?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"在想想" style:UIAlertActionStyleCancel handler:nil]; UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"在想想" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *delete = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { UIAlertAction *delete = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[self deleteReminder:model]; [self deleteReminder:model];
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
<rect key="frame" x="0.0" y="0.0" width="91" height="108"/> <rect key="frame" x="0.0" y="0.0" width="91" height="108"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="remind_cell_0_2" translatesAutoresizingMaskIntoConstraints="NO" id="nuB-Rn-VdK"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="remind_cell_0_1" translatesAutoresizingMaskIntoConstraints="NO" id="nuB-Rn-VdK">
<rect key="frame" x="25.5" y="34" width="40" height="40"/> <rect key="frame" x="23" y="31.5" width="45" height="45"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="40" id="9QJ-Za-gUs"/> <constraint firstAttribute="width" constant="45" id="9QJ-Za-gUs"/>
<constraint firstAttribute="height" constant="40" id="Cvy-XH-9Ai"/> <constraint firstAttribute="height" constant="45" id="Cvy-XH-9Ai"/>
</constraints> </constraints>
</imageView> </imageView>
</subviews> </subviews>
...@@ -37,6 +37,6 @@ ...@@ -37,6 +37,6 @@
</collectionViewCell> </collectionViewCell>
</objects> </objects>
<resources> <resources>
<image name="remind_cell_0_2" width="40" height="40"/> <image name="remind_cell_0_1" width="40" height="40"/>
</resources> </resources>
</document> </document>
...@@ -133,4 +133,14 @@ _Pragma("clang diagnostic pop")\ ...@@ -133,4 +133,14 @@ _Pragma("clang diagnostic pop")\
#define iOS10_Or_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0") #define iOS10_Or_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")
#define iOS8_Or_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0") #define iOS8_Or_GREATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")
#define iOS_Available(version) @available(iOS version, *) #define iOS_Available(version) @available(iOS version, *)
#define IPHONE_X ({\
BOOL isBangsScreen = NO; \
if (@available(iOS 11.0, *)) { \
UIWindow *window = [[UIApplication sharedApplication].windows firstObject]; \
isBangsScreen = window.safeAreaInsets.bottom > 0; \
} \
isBangsScreen; \
})
#endif /* BasicMacro_h */ #endif /* BasicMacro_h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment