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가 인식되지 않는 이유에 대한 아이디어가 있습니까?