Hello users,
I've got a question on how to add a UIView to a UITableViewCell.
In my learning Project I've got a UITableViewController (TableTestViewController, a UITabelViewCell.xib (MainTabelCell.xib) and a UIView (InnerTableView). My Goal ist to show the MainTableCell in the UITableView and in this MainTabelCell the InnerTabelView but I only manage to show the Cell in the Table.
TableTestViewController.h:
#import <UIKit/UIKit.h>
#import "InnerTableView.h"
@interface TableTestViewController : UITableViewController {
UITableView *mainTable;
UITableViewCell *nibLoadedCell;
InnerTableView *innerView;
}
@property(nonatomic, retain) IBOutlet UITableView *mainTable;
@property(nonatomic, retain) IBOutlet UITableViewCell *nibLoadedCell;
@property(nonatomic, retain) InnerTableView *innerView;
@end
TableTestViewController.m:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"MainTableCell"
owner:self options:NULL];
cell = nibLoadedCell;
}
// Configure the cell.
innerView = [[UIViewController alloc] init];
[cell addSubview: innerView.view];
return cell;
}
Does anyone have an Idea why the innerView will not be shown in the TabelViewCell? What did I miss here? I'm still learning all that stuff but after 5 hours I don't find a clue in my Books. Hope this is not a to dumb question :)
Thank you
CaptnCrash