1
섹션 및 행이있는 tableview가 있습니다. 사용자가 행/섹션 내부의 버튼을 클릭하면 특정 버튼 근처에 UIView
이 표시됩니다.행의 단추 근처에 UIView를 추가 하시겠습니까?
- (IBAction) openRoundedPopover:(id)sender {
btn = (UIButton*) sender;
//Identify if user clicked header section or cell row
if (btn.titleLabel.tag == 8)
isHeaderViewButtonClicked = YES; // headerview mean when user clicks on section
else
isHeaderViewButtonClicked = NO;
MainTableViewCell *clickedResourceCell = (MainTableViewCell*)btn.superview.superview;
CGPoint hitPoint = [sender convertPoint:CGPointZero toView:self.tableView];
self.roundedButtonMenu.frame = CGRectMake(43, isHeaderViewButtonClicked ? hitPoint.y+50:clickedResourceCell.frame.origin.y+53, self.roundedButtonMenu.frame.size.width, self.roundedButtonMenu.frame.size.height);
[self.view addSubview:self.roundedButtonMenu];
}
이 모두 정상적으로 작동합니다. 그러나 사용자가 행/섹션을 계속 추가하고 하단 행/섹션의 버튼을 클릭하면 (즉, 새로 추가 된 행/섹션을 보려면 표 뷰를 아래로 스크롤) 해당 버튼 근처에는 UIView
이 표시되지 않습니다. 다른 곳에서 팝업되거나 아예 나타나지 않습니다.
제발 도와주세요! 고맙습니다.
안녕 Daij을, 대답 주셔서 감사합니다! 내가 말한 것처럼 코드를 업데이트했지만 여전히 작동하지 않습니다! 사용자가 tableview를 맨 아래로 스크롤 할 때 UIView가 나타나지 않습니다. 하지만 잘못된 방법으로 셀 값을 검색하는 실수를 바로 잡는 데 도움이됩니다. 감사합니다. – happycoder
조금 편집 ... 셀을 스크롤 할 수있는 경우보기에 단추를 추가하면 작동하지 않습니다. –
셀에 추가하면 (적절하게!) 추가/제거 할 때주의해야합니다. cellForRow : [셀을 다시 사용하는 경우] –