2012-03-06 5 views
2

国と州の選択のために2つのポップオーバーコントローラを使用しています。国と州の詳細はテーブルビューに配置されます。指定されたフレームで別のポップオーバーに表示されます。これは4行のデータに対してうまくいきます。しかし、国のデータ行が4より大きい場合、状態のポップオーバーは他のコーナーに表示されます。 ここでdidSelect行方法ポップオーバーコントロールは異なるテーブルビュー行を選択したときにその位置を変更します

StateSelection_iPad *classCourse = [[StateSelection_iPad alloc] init]; 
popover = [[UIPopoverController alloc] initWithContentViewController:classCourse]; 
    popover.delegate = self; 
    classCourse.popNewDelegate=self; 
    [popover presentPopoverFromRect:CGRectMake(50,-40, 200, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES]; 
[classCourse release]; 

と.MクラスiがWIHテーブルの行をタップして所定のフレームたびにポップオーバーを取得する方法

self.contentSizeForViewInPopover = CGSizeMake(250, 220); 

にポップオーバーを作成するためのコードである「N」の数ディスプレイの行

答えて

0

使用のこのコードpopoveron選択された行

UITableViewCel l * clickedCell =(UITableViewCell *)[[送信者スーパービュー]スーパービュー];

NSIndexPath * clickedButtonPath = [table2 indexPathForCell:clickedCell];

int rows = clickedButtonPath.row;

int section1 = clickedButtonPath.section;

 OR 

NSSet *が[イベントallTouches] =触れます。 UITouch * touch = [touches anyObject]; CGPoint currentTouchPosition = [touch locationInView:self.tableView];

[popover presentPopoverFromRect:CGRectMake(currentTouchPosition.x-10、clickedCell.frame.origin.y + 100,10,10)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

要件に応じてフレームを変更します。

関連する問題