This commit is contained in:
2025-11-09 21:41:35 +08:00
parent 2415e97c97
commit 5e1a1f540e
9 changed files with 289 additions and 38 deletions

View File

@@ -1,14 +1,6 @@
//
// KBSkinDetailVC.m
// keyBoard
//
// UICollectionView
//
// - Section0
// - Section1 cell collectionView Cute/Fresh
// - Section2 cell Recommended Skin
// - Section3 2 使 KBSkinCardCell
//
#import "KBSkinDetailVC.h"
#import <Masonry/Masonry.h>

View File

@@ -2,17 +2,12 @@
// MySkinVC.m
// keyBoard
//
//
//
// - Editor/Cancel
// - CollectionView Masonry +
// - cell
// - bottomView >0 Delete #02BEAC
//
#import "MySkinVC.h"
#import <Masonry/Masonry.h>
#import "UIColor+Extension.h"
#import <MJRefresh/MJRefresh.h>
#import "UIScrollView+KBEmptyView.h" // LYEmptyView
#import "MySkinCell.h"
@@ -25,6 +20,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
@property (nonatomic, strong) UIButton *deleteButton; //
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *data; //
@property (nonatomic, assign) NSInteger loadCount; // /
@property (nonatomic, assign, getter=isEditingMode) BOOL editingMode; //
@end
@@ -39,13 +35,8 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
// Editor/Cancel
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Editor" style:UIBarButtonItemStylePlain target:self action:@selector(onToggleEdit)];
//
self.data = [@[
@{ @"title": @"Dopamine" },
@{ @"title": @"Dopamine" },
@{ @"title": @"Dopamine" },
@{ @"title": @"Dopamine" },
] mutableCopy];
// +
self.data = [NSMutableArray array];
//
[self.view addSubview:self.collectionView];
@@ -63,10 +54,50 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
make.height.mas_equalTo(64);
}];
// LYEmptyView +
__weak typeof(self) weakSelf = self;
[self.collectionView kb_makeDefaultEmptyViewWithImage:nil
title:@"暂无皮肤"
detail:@"下拉刷新试试"
buttonTitle:@"重试"
tapHandler:nil
buttonHandler:^{ [weakSelf.collectionView.mj_header beginRefreshing]; }];
[self.collectionView kb_setLYAutoShowEnabled:NO]; //
//
[self.collectionView kb_endLoadingForEmpty];
// +
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(fetchData)];
//
[self.collectionView.mj_header beginRefreshing];
//
self.bottomView.hidden = YES;
}
#pragma mark - Data
- (void)fetchData {
// 1.0s
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
self.loadCount += 1;
// /
[self.data removeAllObjects];
if (self.loadCount % 2 == 0) {
for (int i = 0; i < 8; i++) {
[self.data addObject:@{ @"title": @"Dopamine" }];
}
}
[self.collectionView reloadData];
[self.collectionView kb_endLoadingForEmpty]; // / emptyView
[self.collectionView.mj_header endRefreshing];
});
}
#pragma mark - Actions
- (void)onToggleEdit {
@@ -112,6 +143,8 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
[self.collectionView deleteItemsAtIndexPaths:selected];
} completion:^(BOOL finished) {
[self updateBottomUI];
// 0
[self.collectionView kb_endLoadingForEmpty];
}];
}

View File

@@ -29,10 +29,10 @@
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
// MySkinVC *vc = [[MySkinVC alloc] init];
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
MySkinVC *vc = [[MySkinVC alloc] init];
// KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
// [self.navigationController pushViewController:vc animated:true];
[self.navigationController pushViewController:vc animated:true];
}
/*