ios - PST Collectionview 对我不起作用?

标签 ios objective-c collectionview pstcollectionview

<分区>

我有一个 Storyboard 项目,其中添加了 PSTCollectionview 类和所有文件。然后我在“PSUICollectionviewcontroller_”中为我的 View Controller “allbooks.h,.m”创建了一个类,但我无法在我的 View Controller 上添加此类? ? 请

GMMAllBooksGrid.h

#import <UIKit/UIKit.h>

@interface GMMAllBooksGrid : PSUICollectionViewController
@end

最佳答案

您可以像使用 UICollectionView 一样使用 PSTCollectionView。我会发布我的代码可能对你有帮助。

CollectionViewController.h

#import <UIKit/UIKit.h>
#import "PSTCollectionView.h"


@interface CollectionViewController : UIViewController <PSUICollectionViewDataSource,PSUICollectionViewDelegate,PSUICollectionViewDelegateFlowLayout>

@property(nonatomic,retain) PSUICollectionView *collectionView;
@end  

CollectionViewController.m

-(void)loadView
{
[super loadView];
self.view.backgroundColor = [UIColor whiteColor];
PSUICollectionViewFlowLayout *layout = [[PSUICollectionViewFlowLayout alloc] init];

// Configure layout attributes globally
layout.itemSize = CGSizeMake(150, 150);

self.collectionView = [[[PSUICollectionView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds)) collectionViewLayout:layout]autorelease];
[self.collectionView setDelegate:self];
[self.collectionView setDataSource:self];
[self.collectionView setAutoresizingMask:UIViewAutoresizingFlexibleHeight |UIViewAutoresizingFlexibleWidth| UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
[self.collectionView setBackgroundColor:[UIColor clearColor]];

// Register Cell and supplimentary views
[self.collectionView registerClass:[PSUICollectionViewCell class] forCellWithReuseIdentifier:CELL_ID];



[self.view addSubview:_collectionView];
}

关于ios - PST Collectionview 对我不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16207374/

上一篇:ios - Objective-C 向未分配的对象发送消息

下一篇:ios - 将 void (^)() 作为完成处理程序传递

相关文章:

ios - Objective-C:如何将字符串传递给 .xib 文件并显示 MapView?

IOS - SWIFT - CollectionView -> ImageView 加载 URL 图片

ios - View Controller 中的多个 Collection View - 未为所有 View 设置委托(delegate)

iphone - 在 iPhone ABAddressBook 中读取性能问题

c# - CollectionView.Refresh不过滤

ios - AVAssetWriter 未知错误

iOS WatchKit - 将键值观察器添加到 NSUserDefaults 崩溃

ios - 导航栏不占满整个屏幕

iphone - 当我的应用程序关闭时是否可以运行后台线程

ios - Objective-C : For loop is finished before image is finished