세포

1

여기 컬렉션 뷰의 코드는 표시되지 않습니다.세포

(gdb) po cell 
<MWTeamCollectionCell: 0x72aff80; baseClass = UICollectionViewCell; frame = (0 0; 50 50); layer = <CALayer: 0x72b0090>> 
(gdb) po cell 
<MWTeamCollectionCell: 0x72b08e0; baseClass = UICollectionViewCell; frame = (67.5 0; 50 50); layer = <CALayer: 0x72b0970>> 
(gdb) po cell 
<MWTeamCollectionCell: 0x8aad380; baseClass = UICollectionViewCell; frame = (135 0; 50 50); layer = <CALayer: 0x8a72d20>> 

답변

1

이 UITabeView 같은 클래스를 등록 할 필요가 없습니다,이 시도 : UICollectionViewCell 및 MWTeamCollectionCell에서 (ID) 초기화를의 정의 :

[yourCollection registerClass:[MWTeamCollectionCell class] forCellWithReuseIdentifier:@"CellName"]; 

그리고 충분 다음

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    MWTeamCollectionCell *cell = [yourCollection dequeueReusableCellWithReuseIdentifier:@"CellName" forIndexPath:indexPath]; 
    //Setting some thing here 

    return cell; 

} 

을 MWTeamCollectionCell을 기억한다. m (팀 이름 라벨 초기화)

iOS5 만 사용하는 경우 UICollectionView가 작동하고 아무 것도 표시하지 않으면

0

UICollectionViewCell 대신 UITableViewCell을 할당하는 것처럼 보입니다.

또한 사용자 정의 수집 셀을 구현 한 방법에 따라 펜촉이 제대로 디코딩 (로드)되었는지 확인하십시오. 인터페이스 빌더의 콘센트 및 식별자 이름이 올바른지 먼저 확인하려면 UICollectionViewCell을 사용하는 것이 좋습니다.

+0

어떻게해야합니까? 인터페이스 빌더의 콘센트 및 식별자 이름이 올바른지 확인하십시오. – Luda

+0

당신이 맞습니다 :) 나는 UITableViewCell을 할당했다. 여기 (여전히 :(작동하지 않습니다) 내 새로운 코드 - (UICollectionViewCell *) collectionView : (UICollectionView *) collectionView cellForItemAtIndexPath : (NSIndexPath *) indexPath { 정적있는 NSString * CellIdentifier = @ "셀"; MWTeamCollectionCell * cell = [_teamsCollection dequeueReusableCellWithReuseIdentifier : CellIdentifier forIndexPath : indexPath] cell.teamName.text = @ "팀 이름" 반환 셀 } – Luda

0

UINib *cellNib = [UINib nibWithNibName:@"MWTeamCollectionCell" bundle:nil];  
[self.collectionView registerNib:cellNib forCellWithReuseIdentifier:@"CellName"]; 

나를 위해 잘 작동 작업 라인

아래에이 라인을 가진

[yourCollection registerClass:[MWTeamCollectionCell class] forCellWithReuseIdentifier:@"CellName"]; 

교체.