- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"Cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
UILabel *titleLabel = (UILabel *)[cell viewWithTag:100];
[titleLabel setText:@"String"];
return cell;}
如何顯示陣列字符串中UILabel
在CollectionView
線,顯示出Exception
是[titleLabel setText:@"String"];
如何顯示陣列字符串中的UILabel在UICollectionView
異常顯示[UICollectionViewCell的setText:]:無法識別的選擇發送到實例0xc531f30 2014-10-01 15:50:32.910 MyTabBar [3626:60B] ***終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因:' - [UICollectionViewCell setText:]:無法識別的選擇器發送到實例0xc531f30' ***第一次拋出調用堆棧: – 2014-09-30 10:22:21
'UILabel * titleLabel =(UILabel *)[cell viewWithTag:100];':'[cell viewWithTag: 100];'是'UICollectionViewCell'。即使你把它放入一個'UILabel',它也不會。 – Larme 2014-09-30 10:27:56
你使用自定義的UICollectionView Cell嗎? – 2014-09-30 10:32:55