0

重複の可能性:
PopOverController で TableView を設定できない - Objective C

「ボタン」というボタンを使っています。それをクリックすると、 PopOverControllerの助けを借りて、TableViewのkkkk配列に存在する内容を表示したいです。つまり、セルに kkkk 配列の内容を表示する小さな tableView をポップアップさせたいとします。

次のコード行を使用しています::

table = [[UITableViewController alloc]init];

popover2 = [[UIPopoverController alloc] initWithContentViewController:table];//Tell which view controller should be shown

[popover2 setPopoverContentSize:CGSizeMake(200, 200)]; // set content size of popover
[popover2 presentPopoverFromBarButtonItem:uploadspace permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; //From where it should "pop"

self.popoverController = popover2;          
popoverController.delegate = self;

NSString *hhDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *hhFilePath = [hisDir stringByAppendingPathComponent:@"hh.txt"];

NSArray *array = [NSArray arrayWithContentsOfFile:hhFilePath ];
kkkk = [[NSMutableArray alloc] init];
for (NSDictionary *dict in array) {
    [keys addObjectsFromArray:[dict allkkkk]];


   // NSLog(@"%@ hellooooooooo", [kkkk objectAtIndex:0]);

}
NSLog(@"hiiiiiii");
NSLog(@"%@", [kkkk objectAtIndex:0]);
table.tableView.delegate=self;
table.tableView.delegate = self;


table.tableView = [[UITableView alloc] initWithFrame:[window bounds]];
// Set up the image view and add it to the view but make it hidden
[window addSubview:table.tableView];

//table.hidden = YES;
[window makeKeyAndVisible];
[self.table.tableView reloadData];

ここで、tView はUITableViewで、テーブルUITableViewControllerです。

「ボタン」を押すと、TableView がポップアップ表示されます。ただし、kkkk 配列の値を入力することはできません。TableView にデータを入力する方法について、Google でよく検索しました。 、しかし、PopOverController を使用して TableView を表示するのは違うと思います。

誰かがそれを整理するのを手伝ってくれますか? ありがとうございます。

4

3 に答える 3

1
table.dataSource = self;
table.delegate = self;
于 2012-06-27T05:37:41.047 に答える
0

上記のように、DataSourceDelegateTableViewを自分のに設定する必要がありますviewController。そして、コードの後半をメソッドに記述しますcellForRowAtIndexPath

于 2012-06-27T05:40:50.967 に答える
0

以下のリンクをチェックしてください。役立つかもしれません。

http://www.raywenderlich.com/1056/ipad-for-iphone-developers-101-uipopovercontroller-tutorial

于 2012-06-27T05:44:25.360 に答える