2011-02-24 3 views
4

사용자 정의에 대한 테이블 바닥 글, 나는 다음과 같은 코드이 사용있는 UIButton 표에서 바닥 글 응답하지

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 
    if(editmode) { 
    if(footerView == nil) { 
     //allocate the view if it doesn't exist yet 
     footerView = [[UIView alloc] init]; 

     //we would like to show a gloosy red button, so get the image first 
     UIImage *image = [[UIImage imageNamed:@"button_green.png"] stretchableImageWithLeftCapWidth:8 topCapHeight:8]; 

     //create the button 
     UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     [button setBackgroundImage:image forState:UIControlStateNormal]; 

     //the button should be as big as a table view cell 
     [button setFrame:CGRectMake(10, 3, 300, 44)]; 

     //set title, font size and font color 
     [button setTitle:@"Photo" forState:UIControlStateNormal]; 
     [button.titleLabel setFont:[UIFont boldSystemFontOfSize:20]]; 
     [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 

     //set action of the button 
     [button addTarget:self action:@selector(selectExistingPicture) forControlEvents:UIControlEventTouchUpInside]; 

     //add the button to the view 
     [footerView addSubview:button]; 
     UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     image = [[UIImage imageNamed:@"button_grey_dark.png"] stretchableImageWithLeftCapWidth:8 topCapHeight:8]; 
     [button2 setBackgroundImage:image forState:UIControlStateNormal]; 

     //the button should be as big as a table view cell 
     [button2 setFrame:CGRectMake(10, 50, 300, 44)]; 

     //set title, font size and font color 
     [button2 setTitle:@"Note" forState:UIControlStateNormal]; 
     [button2.titleLabel setFont:[UIFont boldSystemFontOfSize:20]]; 
     [button2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 

     //set action of the button 
     [button2 addTarget:self action:@selector(mkFolder) forControlEvents:UIControlEventTouchUpInside]; 

     //add the button to the view 
     [footerView addSubview:button2]; 

     //  [button setupAsRedButton]; 
    } 

    //return the view for the footer 
    return footerView; 
    } 
    return nil; 
} 

를 사용하고, 첫 번째 단추는 완벽하지만, 두 번째는 이벤트를 등록하지 않습니다 응답합니다. 함수가 존재하지 않더라도 null 함수 오류는 생성되지 않습니다. UITouchUpInside가 인식되지 않는 이유에 대한 아이디어가 있습니까?

답변

9

Doh !!!

오른쪽이 코드 아래, 나는 50 개 픽셀 아래 아무것도 무시하도록 UIView의 설정

// specify the height of your footer section 
- (CGFloat)tableView:(UITableView *)tableView 
heightForFooterInSection:(NSInteger)section { 
    //differ between your sections or if you 
    //have only on section return a static value 
    return 50; 
} 

했다. 그것을 100으로 바꿨고 나는 좋았다.