Я создал приложение для Windows, добавил UITabBarController.В качестве элементов представления в каждой вкладке я добавил навигационный контроллер (из панели объектов).Затем я создал подкласс UITableViewController с файлом XIB.И изменил (в свойствах) представление UINavigationController, которое я добавил ранее в мой подкласс.После этого я изменил следующие строки.
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"devices", @"my devices");
NSMutableArray *array = [[NSArray alloc] initWithObjects: @"Kitchen", @"Door 1", @"Door 2", nil];
self.devicesArray = array; // it's a private variable
[array release];
NSLog(@"%@", [self.devicesArray objectAtIndex:0]);
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.devicesArray count];
}
- (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] autorelease];
}
// Configure the cell...
NSInteger row = [indexPath row];
cell.textLabel.text = [devicesArray objectAtIndex:row];
return cell;
}
Но я вижу только чистый UITableView.Без текста.Но NSLog правильно выводит текст в viewDidLod