Commit 3e133224 authored by zhangguangyi's avatar zhangguangyi

update

parent 58c5ce6e
No preview for this file type
......@@ -90,9 +90,10 @@
{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(SCREEN_WIDTH / 4, 60);
layout.itemSize = CGSizeMake(SCREEN_WIDTH / 4, 70);
layout.minimumLineSpacing = 0;
layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(10, 0, 0, 0);
_collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
......
......@@ -73,6 +73,9 @@ static NSString * const ZJReminderFooterViewID = @"ZJReminderFooterViewID";
if (i == 1) {
model.iconUrl = self.model.iconUrl;
}
if (i == 2) {
model.subName = self.model.name;
}
[self.dataArray addObject:model];
}
......
......@@ -21,6 +21,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
@property(nonatomic,strong)ZJReminderBottom *bottomView;
@property(nonatomic,strong)NSMutableArray *dataArray;
@property(nonatomic,assign)BOOL isManger;
@property(nonatomic,strong)UIBarButtonItem *mangerButtonItem;
@end
......@@ -49,7 +50,9 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
if (self.model) {
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 setupUI];
......@@ -73,10 +76,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
self.bottomView = [[ZJReminderBottom alloc] init];
[self.view addSubview:self.bottomView];
CGFloat bottomMargin = IPHONE_X ? (-20 - 39) : -20;
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(20);
make.right.mas_equalTo(-20);
make.bottom.mas_equalTo(-20);
make.bottom.mas_equalTo(bottomMargin);
make.height.mas_equalTo(44);
}];
......@@ -87,7 +92,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
if (weakSelf.isManger) {
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{
NSLog(@"添加提醒");
ZJReminderCateAddController *vc = [ZJReminderCateAddController new];
......@@ -110,6 +122,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
} failure:^(NSError * _Nonnull error) {
}];
// NSDictionary *dict = @{@"remindTypeId":@(self.model.id)};
// [[TQNetworkTools shared] postWithAction:reminderDeleteCategory parameters:dict success:^(id _Nonnull response) {
// if ([response[@"status"] intValue] == 200) {
......@@ -124,12 +137,12 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
-(void)chooseAction
{
NSString *name = self.navigationItem.rightBarButtonItem.title;
NSString *name = self.mangerButtonItem.title;
if ([name isEqualToString:@"管理"]) {
self.navigationItem.rightBarButtonItem.title = @"取消";
self.mangerButtonItem.title = @"取消";
[self exchangeChooseState:YES];
}else{
self.navigationItem.rightBarButtonItem.title = @"管理";
self.mangerButtonItem.title = @"管理";
[self exchangeChooseState:NO];
}
}
......@@ -167,6 +180,14 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
}else{
[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];
} failure:^(NSError * _Nonnull error) {
......@@ -200,7 +221,7 @@ static NSString *ZJReminderMainCellID = @"ZJReminderMainCellID";
ZJReminderMainCell *cell = (ZJReminderMainCell *)sender.superview.superview;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
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 *delete = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[self deleteReminder:model];
......
......@@ -16,11 +16,11 @@
<rect key="frame" x="0.0" y="0.0" width="91" height="108"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="remind_cell_0_2" translatesAutoresizingMaskIntoConstraints="NO" id="nuB-Rn-VdK">
<rect key="frame" x="25.5" y="34" width="40" height="40"/>
<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="23" y="31.5" width="45" height="45"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="9QJ-Za-gUs"/>
<constraint firstAttribute="height" constant="40" id="Cvy-XH-9Ai"/>
<constraint firstAttribute="width" constant="45" id="9QJ-Za-gUs"/>
<constraint firstAttribute="height" constant="45" id="Cvy-XH-9Ai"/>
</constraints>
</imageView>
</subviews>
......@@ -37,6 +37,6 @@
</collectionViewCell>
</objects>
<resources>
<image name="remind_cell_0_2" width="40" height="40"/>
<image name="remind_cell_0_1" width="40" height="40"/>
</resources>
</document>
......@@ -133,4 +133,14 @@ _Pragma("clang diagnostic pop")\
#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 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 */
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