Я установил ViewController (с xib) с помощью UITableView. Я установил контроллер представления для работы в качестве источника данных и делегата для представления таблицы. Все кажется на месте, но я не могу контролировать данные ячейки, потому что CellForRow ... никогда не называется.CellForRow .. Never Называется
Мой .h
#import <UIKit/UIKit.h>
@interface MyViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>
@property IBOutlet UITableView *tableView;
@end
мой .m
#import "MyViewController.h"
@interface MyViewController()
@end
@implementation MyViewController
- (id)init{
self = [super init];
if (self) {
// Custom initialization
}
return self;
}
- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
// Return the number of sections.
return 0;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
// Return the number of rows in the section.
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.textLabel.textColor = [UIColor blackColor];
cell.textLabel.text = @"SOMETHING";
return cell;
}