Skip to content

Commit

Permalink
修复 bundle 加载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
sunyazhou committed Mar 22, 2018
1 parent 19246dc commit 582456a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions PhotoPickerKit/KSYAlbumViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ - (void)configSubviews{
strongSelf.tableView.tableFooterView = [[UIView alloc] init];
strongSelf.tableView.dataSource = self;
strongSelf.tableView.delegate = self;
[strongSelf.tableView registerNib:[UINib nibWithNibName:@"KSYAlbumCell" bundle:nil] forCellReuseIdentifier:@"KSYAlbumCell"];
NSBundle *bundle = [NSBundle bundleForClass:[KSYPhotoPickerController class]];
[strongSelf.tableView registerNib:[UINib nibWithNibName:@"KSYAlbumCell" bundle:bundle] forCellReuseIdentifier:@"KSYAlbumCell"];
[strongSelf.view addSubview:strongSelf.tableView];
[strongSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(strongSelf.view);
Expand Down Expand Up @@ -121,7 +122,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
KSYAlbumModel *model = self.albums[indexPath.row];

KSYAssetViewController *assetVC = [[KSYAssetViewController alloc] initWithNibName:@"KSYAssetViewController" bundle:nil];
KSYAssetViewController *assetVC = [[KSYAssetViewController alloc] initWithNibName:@"KSYAssetViewController" bundle:[NSBundle bundleForClass:[KSYPhotoPickerController class]]];
assetVC.model = model;
[self.navigationController pushViewController:assetVC animated:YES];
}
Expand Down
3 changes: 2 additions & 1 deletion PhotoPickerKit/KSYAssetViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ - (void)configCollectionView {
self.collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin);

self.collectionView.contentSize = CGSizeMake(CGRectGetWidth(self.view.frame), ((self.model.assetsCount + 4 - 1) / 4) * CGRectGetWidth(self.view.frame));
UINib *nib = [UINib nibWithNibName:@"KSYAssetCell" bundle:[NSBundle mainBundle]];
NSBundle *bundle = [NSBundle bundleForClass:[KSYPhotoPickerController class]];
UINib *nib = [UINib nibWithNibName:@"KSYAssetCell" bundle:bundle];
[self.collectionView registerNib:nib forCellWithReuseIdentifier:@"KSYAssetCell"];
}

Expand Down

0 comments on commit 582456a

Please sign in to comment.