Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating embedded cells in XIB?

I am currently trying to create a table that will show the current downloads the user is downloading with a progress bar and details in each cell.

The project im working on is using xib and xib apparently does not support embedded sections in table views

Table views with embedded sections and cells are only supported in storyboard documents

Can I use Storyboard for a standalone UITableViewController? if so how?

Also is there a way around this for what im trying to do? If so how what would the workaround be?

Thanks in advance I have been stuck on this for the past couple of hours.

self.rootController = [[UITabBarController alloc] init];
ViewController1 *view2 = [[ViewController1 alloc] init];
TableViewController *view3 = [[TableViewController alloc] init];

view3.tabBarItem.title = @"Documents";
appWebView = [[WebViewController alloc] init];
appWebView.title = @"Browser";
appWebView.tabBarItem.title = @"Browser";
view2.title = @"Downloads";
self.rootController.viewControllers = [NSArray arrayWithObjects:appWebView, view2, view3,  nil];
self.window.rootViewController = self.rootController;
appWebView.tabBarItem.image = [UIImage imageNamed:@"Browser.png"];
view2.tabBarItem.image = [UIImage imageNamed:@"Download.png"];


 _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

[_window setRootViewController:appWebView];
[_window makeKeyAndVisible];
[_window addSubview:_rootController.view];

^^ is AppDelegate and below is the view i want to work with storyboard

@interface TableViewController ()

@end

@implementation TableViewController



- (void)viewDidLoad
{
[super viewDidLoad];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"TableViewController" bundle:nil];
TableViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"TableViewController"];
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:sfvc animated:NO completion:nil];

}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
like image 621
nickivey Avatar asked Nov 10 '22 06:11

nickivey


1 Answers

When you use table view in Xib(Base Xib). You have to create separate UITableViewCell. and you should register the UITableViewCell in the Base Xib View. Please follow the below code.

override func awakeFromNib() {
    Yourtableview.register(UINib.init(nibName: "cellnibname", bundle: nil), forCellReuseIdentifier: "identifier")
}
like image 51
Ramkumar Avatar answered Nov 15 '22 07:11

Ramkumar