我正在尝试使用CollectionView制作应用,但我遇到了问题。从我的代码中可以看出,我在numberofSectionsINCollectionView和numberOfItemsInsection中都收到了回调,但是无法在cellForItemAtIndexPath中接收回调,这使得单元格不会显示在CollectionView中。但是,对于另一台具有相同Xcode版本并连接到同一iPhone(6 Plus)的计算机,我可以在cellForItemAtIndexPath中接收回调。
我不知道为什么。你能告诉我如何解决这个问题吗?我认为它归功于Xcode中的设置,但我不确定。
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
if (self.useSection) {
return self.dataSource.count;
}
return 1;}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
if (self.useSection)
return [[self.dataSource objectAtIndex:section] count];
return self.dataSource.count; }
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:[self reuseIdentifierForIndexPath:indexPath] forIndexPath:indexPath];
return cell;
}
我仔细检查委托是否设置为
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
答案 0 :(得分:0)
$.ajax({
url: "playertwoscript.php",
method: 'GET/POST',
data: { test: "test" }
success: function (data) {}
})