보 변화에 jquery 과 업데이트
-
21-12-2019 - |
문제
저는 오히려 복잡한 형태의 것에 배치 UITableView
.이 양식은 일 UICollectionView
내부에는 테이블 보기 셀룰라고는 또한 몇몇 선택 표시되는 동일한 방법에 있는 달력 응용 프로그램:
지금 내가 이것을 할 때에 내 응용 프로그램 중 하나 UICollectionView
내가 가져보다 그것이 어떻게 시작과 그것은 계속(추가 빨간 테두리 되었는지 확인합 UICollectionView
는 크기가 조정되):
나를 디버깅 UICollectionView
뷰를 제공 그러나 그것은 결코 변화는(그것의 get/set 지 않다라는 것보다 더 많은 내가 예상되)-더라도 때에 그것을 인쇄 cellForRowAtIndexPath
그것은 나타 크기가 조정됩니다.어떤 방법이 나는 디버깅할 수 있습니다 이것은 더 나은,또는 누군가가 되었습에서 동일한 상황입니까?
감사합니다!
코드:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//self.campos is a dictionary with sections and rows stored
NSMutableArray *infoCampos = [[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"];
NSDictionary *infoCampo = [infoCampos objectAtIndex:indexPath.row];
if ([[infoCampo objectForKey:@"nome"] isEqualToString:@"dosePorComprimido"]) {
//Remove picker cell if finds it
for (infoCampo in infoCampos) {
if ([infoCampo objectForKey:@"view"] == self.dosagemMedicamento.view) {
[infoCampos removeObject:infoCampo];
[tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
return;
}
}
//Insert new cell
infoCampo = [infoCampos objectAtIndex:indexPath.row];
[infoCampos addObject:@{@"tipo":@5, @"view":self.dosagemMedicamento.view, @"nome":[infoCampo objectForKey:@"nome"]}];
[tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];
[self.dosagemMedicamento.view.superview addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[pickerDosagem]|" options:0 metrics:nil views:@{@"pickerDosagem":self.dosagemMedicamento.view}]];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
UIView *view;
if ([infoCampo objectForKey:@"view"]) {
view = (UIView *) [infoCampo objectForKey:@"view"];
return view.frame.size.height;
}
return 44.0f;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath
{
UITableViewCell *cell;
NSMutableDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
UIView *view;
cell = [tableView dequeueReusableCellWithIdentifier:[[infoCampo objectForKey:@"nome"] stringByAppendingString:@"ViewLinhaCellView"] forIndexPath:indexPath];
view = [cell viewWithTag:1];
[view addSubview:[infoCampo objectForKey:@"view"]];
return cell;
}
편집: 언급하는 것을 잊었는지 테이블 보기 reloadData 만 필요한 섹션/행 reloadRowsAtIndexPaths 및 reloadSections.그래서 그것을 만드는도 괴상이기 때문에 나가지를 다시 로드하는 특정 섹션입니다.
EDIT2: 추가 데이터 원본을 전자 대리인 코드
해결책
내가 믿는 당신의 문제가 여기에의 구현 tableView:heightForRowAtIndexPath:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
UIView *view;
if ([infoCampo objectForKey:@"view"]) {
view = (UIView *) [infoCampo objectForKey:@"view"];
return view.frame.size.height;
}
return 44.0f;
}
보기일 조정에 의해 자동차 배치 또는 그것의 자동으로 크기가 조정 마스크입니다.가 없는 충분한 정보를 원하시면 여기를 정확하게 말 왜지만,테이블 보고 자동 레이아웃을 수 있는 몇 가지 재미있는 동작입니다.추천냥을 반환하는 높이를 설정하기보다는 점점에서 높이 view:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *infoCampo = [[[self.campos objectAtIndex:indexPath.section] objectForKey:@"campos"] objectAtIndex:indexPath.row];
UIView *view;
if ([infoCampo objectForKey:@"view"]) {
if ([infoCampo objectForKey:@"viewHeight"]) {
return [[infoCampo objectForKey:@"viewHeight"] floatValue];
} else {
return 216.0f;
}
}
return 44.0f;
}
이 viewHeight
키을 지정할 수 있도록 사용자 지정 고도에 대한 각각의 세포기,그러나 이 구현한 반환하는 기본 높이(216)일어나는 것 기준 고도에 대한 선택을 전망이다.