축소판을 만들 때 셀의 너비를 줄이려고합니다. 아이폰의 사진 응용 프로그램과 매우 흡사합니다.UITableViewCell의 크기 결정
이 내가 가진 무엇 :
int photoWidth = self.frame.size.width/4;
나는 표 셀의 높이와 너비를 알아낼 수 없습니다 :
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
int photoWidth = self.frame.size.width/4;
thumbnail1 = [[ThumbnailButton alloc] initWithFrame:CGRectMake(0, 0, photoWidth, 40) ];
thumbnail2 = [[ThumbnailButton alloc] initWithFrame:CGRectMake(photoWidth, 0, photoWidth, 40) ];
thumbnail3 = [[ThumbnailButton alloc] initWithFrame:CGRectMake(photoWidth * 2, 0, photoWidth, 40) ];
thumbnail4 = [[ThumbnailButton alloc] initWithFrame:CGRectMake(photoWidth * 3, 0, photoWidth, 40) ];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self.contentView addSubview:thumbnail1];
[self.contentView addSubview:thumbnail2];
[self.contentView addSubview:thumbnail3];
[self.contentView addSubview:thumbnail4];
}
return self;
}
내 주요 문제는 함께입니다.
어떤 도움
는이 시점에서, 당신이 그것을 말할하지 않는 한 그것이 얼마나 큰 알 수없는 결정에 테이블 셀을 건배, 스테판
정말로,하지만 여기에 일부 메모리가 누출되었습니다. '[... autorelease]'를 모든 alloc 문에 추가하십시오. – mvds
잡기에 감사드립니다. 나는 여전히 Objective-C에 대해 상당히 새로운 것입니다. –
또한이 시점에서 그리드를 만들려고합니다.이 경우에는 그렇게하지 마십시오. 기존의 성숙한 코드를 활용하십시오. 'AQGridView'는 여기에 잘 어울릴 것입니다. 셀에 이미지를 넣고 셀의 너비가 슈퍼 뷰 너비에 고르게 나눠지지 않으면 컨텐트 오프셋을 조정하면됩니다. 모든 것이 오른쪽으로 정렬됩니다. 매우 사용하기 쉽습니다. – jer