내 tableview에, 즉, tablefooterview에서 "이동 홈"버튼 (화면의 중앙에)를 보여주는 두 개의 문제가있는 경우 tableview의 끝에 아직 도달하지 않았습니다. 첫 번째 사진에서 볼 수 있듯이 화면의 가운데에 홈 버튼이 나타나고 싶지 않습니다. 테이블의 맨 아래에 있어야합니다.
두 번째 문제는 일반적으로 뷰의 맨 위에 위치하는 분할 컨트롤입니다. 속하지 않는 하나의 셀에서 재발생합니다. 나는 셀 재사용이 불가능하다는 것을 확인했다.
셀은 텍스트로 채워지므로 세분화 된 컨트롤이 표시되는 이유를 알 수 없습니다.
편집 : 코드 세포를 채우는
코드를 추가 : 바닥 글에 대한
if(indexPath.section == 2){
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText:_actor.actorBeschrijving];
if([[cell textLabel] text] == nil)
{
[[cell textLabel] setText:@"Druk om een beschrijving toe te voegen"];
[[cell textLabel] setTextColor:[UIColor grayColor]];
}
}
if(indexPath.section == 3 && control.selectedSegmentIndex == 1){
if([has count] == 0){
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText: @"Voeg een nieuw object toe"];
}
else{
if(indexPath.row < [has count]){
AnObject *object = (AnObject*)[has objectAtIndex:indexPath.row];
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText:object.objectNaam];
}
if(indexPath.row == [has count]){
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText:@"Voeg een nieuw object toe"];
}
}
}
if(indexPath.section == 3 && control.selectedSegmentIndex == 3){
if([isResponsible count] == 0){
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText: @"Voeg een nieuwe goal toe"];
}
else{
if(indexPath.row < [isResponsible count]) {
Goal *goal = (Goal*)[isResponsible objectAtIndex:indexPath.row];
[[cell textLabel] setText:goal.goalNaam];
}
if(indexPath.row == [isResponsible count]){
[[cell textLabel] setTextAlignment:UITextAlignmentLeft];
[[cell textLabel] setText: @"Voeg een nieuwe goal toe"];
}
}
}
코드 (그것의 단지 조각을하지만 다른 셀에서 바로 다른 텍스트의, 아무것도 변경되지 않습니다) :
@property (nonatomic, retain) IBOutlet UIView *myFooterView;
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
if(section == tableView.numberOfSections - 1)
return 50.0f;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if(myFooterView == nil) {
//allocate the view if it doesn't exist yet
myFooterView = [[UIView alloc] init];
//create the button
UIButton *footButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[footButton setFrame:CGRectMake(110, 10, 100, 30)];
//set title, font size and font color
[footButton setTitle:@"Go Home" forState:UIControlStateNormal];
[footButton.titleLabel setFont:[UIFont boldSystemFontOfSize:18]];
//set action of the button
[footButton addTarget:self action:@selector(clickPressed:)
forControlEvents:UIControlEventTouchUpInside];
//add the button to the view
[myFooterView addSubview:footButton];
}
//return the view for the footer
return myFooterView;
}
내선 ra 코멘트 : 하나의 섹션 만있는 다른 뷰 (다른 테이블 뷰)에서 같은 바닥 글을 사용하고 있습니다. 여기에서는 버튼이 올바르게 표시됩니다.
버튼을 바닥 글보기와 'cellForRowAtIndexPath' 내의 코드에 추가 할 수 있습니까? –
코드를 추가했습니다. 한번보세요. – Fuzej