Xcode6 对于';没有可见的@界面;NSMutableArray';声明选择器';ShuffleArray';
这应该很简单。我所要做的就是随机化一个NSArray。我发现了一个叫做“ShuffleArray”的小插件 所以我现在应该完成了。我导入了NSArray+Shuffle.hXcode6 对于';没有可见的@界面;NSMutableArray';声明选择器';ShuffleArray';,xcode6,nsarray,shuffle,Xcode6,Nsarray,Shuffle,这应该很简单。我所要做的就是随机化一个NSArray。我发现了一个叫做“ShuffleArray”的小插件 所以我现在应该完成了。我导入了NSArray+Shuffle.h #import "NSArray+Shuffle.h" 我添加了一个ShuffleArray接口: @interface TipCollectionViewController () { AJNotificationView *panel; NSString * query; // CLLocatio
#import "NSArray+Shuffle.h"
我添加了一个ShuffleArray接口:
@interface TipCollectionViewController ()
{
AJNotificationView *panel;
NSString * query;
// CLLocationManager * locationManager;
NSMutableArray * _entries;
// NSArray *shuffledArray;
int page;
int c_page;
NSArray *mostPopular;
NSArray *ranDom;
NSRange blueRange;
//int pageNum;
//NSString *phpLink;
NSMutableData *responsePlaceData;
}
-(NSMutableArray *)shuffledArray;
@property (nonatomic, weak) IBOutlet CollectionLayout *tipsLayout;
@property (nonatomic, strong) UIImageView *menuImage;
//@property SESpringBoard *board2;
@property (nonatomic, retain) NSMutableArray *itemCounts;
@end
…但当我尝试将数组随机化时:
ranDom = [_entries shuffledArray];
它告诉我不存在名为ShuffleArray的NSMutableArray接口
知道我哪里出错了吗?这让我头疼。我会尽我所能
首先,这家伙的代码、说明和github页面都错了
ranDom = [_entries shuffledArray];
…永远不会工作
因为在源代码中,他的方法实际上是:
bjl_shuffledArray
所以
工作
第二个问题实际上是我的错
我写信给:
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
…当我应该写信给:
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
因此,解决方案是:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
{
ranDom = [_entries bjl_shuffledArray];
mostPopular = [[_entries reverseObjectEnumerator]allObjects];
if (isChangeData){
NSLog(@"Most Popular");
dataLand = mostPopular;
}
else if(isChangeData2){
NSLog(@"Random");
dataLand = ranDom;
}
else{
NSLog(@"All");
dataLand = _entries;
}
Place *p = [dataLand objectAtIndex:indexPath.item];
}
“dataLand”是我想出的另一个NSArray
现在它工作了!我真的需要多睡一会儿了