처음에 나는 ipad/ipod/iphone 개발과 objective-c에 정말 새로운 것이라고 말하고 싶다.UITableViewCell.accessoryView에서 PopOver Controller를 호출하는 방법은 무엇입니까?
내가 말하길, Xcode와 IB를 사용하는 작은 응용 프로그램을 개발하기 위해 노력하고 있습니다. 기본적으로 테이블에 각 UITableViewCell에 대한 테이블이 있으며 accessoryView에 이미지.
UIImage *img = [UIImage imageNamed:@"myimage.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, img.size.width, img.size.height);
button.frame = frame; // match the button's size with the image size
[button setBackgroundImage:img forState:UIControlStateNormal];
// set the button's target to this table view controller so we can interpret touch events and map that to a NSIndexSet
[button addTarget:self action:@selector(checkButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
button.backgroundColor = [UIColor clearColor];
cell.accessoryView = button;
가 지금까지 너무 좋아, 이제 문제는 내가 사용자가 셀의 accessoryView의 버튼을 탭하면 팝 오버 제어를 표시 할 것입니다 : 여기
는 코드입니다.
는 내가있는 tableView의 "accessoryButtonTappedForRowWithIndexPath"에이 시도 :
UITableViewCell *cell = [myTable cellForRowAtIndexPath:indexPath];
UIButton *button = (UIButton *)cell.accessoryView;
//customViewController is the controller of the view that I want to be displayed by the PopOver controller
customViewController = [[CustomViewController alloc]init];
popOverController = [[UIPopoverController alloc]
initWithContentViewController: customViewController];
popOverController.popoverContentSize = CGSizeMake(147, 122);
CGRect rect = button.frame;
[popOverController presentPopoverFromRect:rect inView:cell.accessoryView
permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
이 코드의 문제는 내가 "의 값을보고 디버깅하는 동안이 응용 프로그램보기의 맨 위에있는 팝 오버를 보여주고 있다는 것입니다 RECT "그리고 그들은 다음과 같습니다 팝 오버가 그래서 제 질문은 팝 오버 그냥 나타날 때까지 내가 정확한 값을 얻을 수있는 방법이며, 뷰 최대 있도록 표시하는 이유
x = 267
y = 13
그래서 나는 그것이 매우 명백하다고 생각 액세서리의 버튼 아래 ce의보기 뭐야?
또한 볼 수 있듯이 "inView :"속성에 대해 "cell.accessoryView"를 사용한다고 말하면 괜찮습니까?
많은 감사를, 그 완전히 일! – Vic