Skip to content

使用过程中有一些问题 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ - (void)configure{

- (id)fetchLocalData{
@weakify(self);
[[YYCache sharedCache] objectForKey:CMHSearchFarmsHistoryCacheKey withBlock:^(NSString * _Nonnull key, NSArray <NSCoding> * _Nullable object) {
[[YYCache sharedCache] objectForKey:CMHSearchFarmsHistoryCacheKey withBlock:^(NSString * _Nonnull key, id<NSCoding> object) {
@strongify(self);
// 子线程执行任务(比如获取较大数据)
dispatch_async(dispatch_get_main_queue(), ^{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ - (UIImage *)fetchLocalData{
/// sub class can override ,且不用调用 super, 直接重写覆盖
@weakify(self);
/// 异步
[[YYCache sharedCache] objectForKey:CMHExample06RemoteImageCacheKey withBlock:^(NSString * _Nonnull key, UIImage * _Nonnull object) {
[[YYCache sharedCache] objectForKey:CMHExample06RemoteImageCacheKey withBlock:^(NSString * _Nonnull key, id<NSCoding> object) {
@strongify(self);
UIImage *image = (UIImage *)object;
// 子线程执行任务(比如获取较大数据)
dispatch_async(dispatch_get_main_queue(), ^{
// 通知主线程刷新 神马的
self.localView.image = object;
self.localView.image = image;

self.navigationItem.rightBarButtonItem = MHObjectIsNil(object)?nil:self.clearItem;
self.navigationItem.rightBarButtonItem = MHObjectIsNil(image)?nil:self.clearItem;

});
}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ - (nullable UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPat
CGFloat itemX = sectionInset.left + (itemW + minimumInteritemSpacing) * (indexPath.item % self.columnCount) + currentPage * width;
itemX = sectionHomepageX + itemX;

CGFloat itemY = sectionInset.top + (itemH + minimumLineSpacing) * ((indexPath.item - self.pageSize * currentPage) / self.rowCount);
CGFloat itemY = sectionInset.top + (itemH + minimumLineSpacing) * ((indexPath.item - self.pageSize * currentPage) / self.columnCount);

/// 获取原布局
UICollectionViewLayoutAttributes* attributes = [[super layoutAttributesForItemAtIndexPath:indexPath] copy];
Expand Down