私はiPhone開発者の初心者ですが、
私のアプリケーションでは、ボタンをクリックするとポップオーバーが表示されます。
私がやりたいことは、ポップオーバーで任意の行を選択すると、そのセルは次のような右矢印の画像でマークされるべきです:
cell.accessoryType = UITableViewCellAccessoryCheckmark;
その選択した行のテキストを取得したい。
要するに、ポップオーバーにチェックボックスを実装したいのですが、5行が選択されている場合、その5行のテキストをフェッチして配列に保存したいのです。
これが私のコードです:
-(void)btnClicked{
UIViewController* popoverContent = [[UIViewController alloc]init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(110, 0, 500, 4)];
UITableView *table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 250, 665) style:UITableViewStylePlain];
[table setDelegate:(id<UITableViewDelegate>)self];
[table setDataSource:(id<UITableViewDataSource>)self];
[self.view addSubview:table];
[table release];
[popoverView addSubview:table];
popoverContent.view = popoverView;
popoverContent.contentSizeForViewInPopover = CGSizeMake(250, 600);
self.popoverController = [[UIPopoverController alloc]
initWithContentViewController:popoverContent];
[self.popoverController presentPopoverFromRect:CGRectMake(100,0, 535, 35)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[popoverView release];
[popoverContent release];
}
この後、配列を UITableView に渡します。
前もって感謝します !