일부 셀이 채워진 UITableView가 있습니다. 다음 스 니펫을 사용하여 UIButton을 만들었습니다. 섹션 머리글 중 하나 옆에 배치되었습니다.UITable 스크롤 후 UIButton을 클릭 할 수 없습니다.
UIButton *addButton = [UIButton buttonWithType:UIButtonTypeCustom];
[addButton addTarget:self action:@selector(addButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[addButton setBackgroundImage:[UIImage imageNamed:@"add.png"] forState:UIControlStateNormal];
addButton.backgroundColor = [UIColor clearColor];
addButton.frame = CGRectMake(270, 150, 29, 29);
버튼이 올바르게 배치되고 작동합니다. 그러나보기가 스크롤 된 후 (심지어 1 픽셀 정도) 버튼이 한 번 작동 한 다음 응답을 멈 춥니 다. 클릭에 대한 조치가 응답하지 않으면 버튼이 트리거되지 않고 '우울한'그림자가 표시되지 않습니다. 응용 프로그램의 나머지 부분은 정상적으로 실행되며 충돌하지 않습니다.
스크롤을 한 번 더 클릭하면 다시 작동하지 않기 때문에 이상하게 보입니다. 버튼은 테이블에 행을 삽입하는 데 사용되므로 추가 행이 눌린 후 경계 또는 무언가가 깨질 수 있습니다.
버튼을 누르면 기능 :
- (void)addButtonPressed {
self.addClientTable.editing = YES;
// First figure out how many sections there are
NSInteger lastSectionIndex = [self numberOfSectionsInTableView:self.addClientTable] - 1;
// Then grab the number of rows in the last section
NSInteger lastRowIndex = [self.addClientTable numberOfRowsInSection:lastSectionIndex];
[self.addClientTable insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:lastRowIndex inSection:lastSectionIndex]] withRowAnimation:UITableViewRowAnimationRight];
self.addClientTable.editing = NO;
}
경우 addClientTable
는 jQuery과입니다.
UIButton이 클릭에 대한 반응을 멈추게 할 수있는 원인은 무엇입니까?
addClientTable이 귀하의 tableview입니까? – Martol1ni
예, 그렇습니다. * (채우기 공간) * – Ollie