Popular TableView with the use of UIPopOverController - Objective C

advertisements

Possible Duplicate:
Unable to Populate TableView In PopOverController - Objective C

I am using a button called as "button". On clicking it I want to display the contents that are present in my kkkk array in TableView with the help of PopOverController i.e. I want a small tableView to pop up whose cells show the contents of kkkk array.

I am using the following lines of code ::

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];

Here, tView is UITableView and table is UITableViewController.

I am able to get the TableView to pop up on the press of my "button'. But, however, I am unable to populate it with the values of my kkkk array. I searched a lot on google as to how to populate a TableView, but to display TableView with the use of PopOverController is different I suppose.

Can anyone help me to sort it out. Thanks and Regards.


check out the link below, it may help you.

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