-3

i had learned objective C 2 weeks ago, i get a project to front end, and i had stuck with one problem. I have my own class instead of default UITableView. With help of these class was created controller, let it be UniversalViewNavigationController, which show some table with content in cells, and i have a MainViewController where these cells show in popover. I need to show these tableView like simple table view, in my view, not in popover, how can i do these?

P.S. Sorry for my English, i hope you understand me :)

How it init's now MainController

.h file

UIPopoverController *objectsTableViewPopover;

.m file, ViewDidLoad

 UniversalViewNavigationController *tablePopoverVC = [[UniversalViewNavigationController alloc] initWithTableSize:CGSizeMake(300, 550)];
    tablePopoverVC.delegate = self;
    objectsTableViewPopover = [[UIPopoverController alloc] initWithContentViewController:tablePopoverVC];
    objectsTableViewPopover.popoverContentSize = tablePopoverVC.viewSize;

and IBAction

-(IBAction)navigationButtonClick:(id)sender
{
    UIButton *tappedButton = (UIButton *)sender;

    [objectsTableViewPopover presentPopoverFromRect:tappedButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
Roman Simenok
  • 530
  • 7
  • 22
  • 2
    Have you tried a container view? – Abizern Aug 14 '13 at 14:40
  • possible duplicate of [How to add an UIViewController's view as subview](http://stackoverflow.com/questions/1486832/how-to-add-an-uiviewcontrollers-view-as-subview) – Abizern Aug 14 '13 at 15:14
  • I have edited description of my problem, i don't really know if a need to use container view, how to add view to container view programmatically? and better to add container in storyboard or in code? Thank's. – Roman Simenok Aug 15 '13 at 09:32
  • In there anything in the [View Controller Programming Guide](http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html) that helps you? Particularly the section on Container View Controllers? – Abizern Aug 15 '13 at 09:35
  • I think there is anything but i'm to young programer to understand it, and it's all in English. So i wrote here in hope that somebody helps me :) – Roman Simenok Aug 15 '13 at 10:07
  • In which case the two answers below should work. You should be using the storyboard, and you should be using container view controllers, but it will take you a bit of time to learn about them. The answers you get from here will also be in English, so I'm not sure what more help I can give you. – Abizern Aug 15 '13 at 10:11

2 Answers2

1
UIView *view = exampleViewController.view; // or exampleViewController.tableView;
[mainViewController.view addSubView:view];
Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
Leta0n
  • 571
  • 2
  • 8
1

Just do this

[mainViewController.view addSubView:exampleViewController.view];

You may need to adjust the frame.

sbarow
  • 2,759
  • 1
  • 22
  • 37