UITableView doesn't show elements
I have created Windows-based application, added UITabBarController. As elements of view in every tab i added navigation controller (from objects panel). Then i have created a subclass of UITableViewController with xib file. And changed (in properties) the view of UINavigationController i added before into my subclass. After this i changed the next lines.
- (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;
}
But i can see only clean UITableView. Without the text. But NSLog outputs text in viewDidLod properly
Check you have set up the delegate and dataSource outlet connections in the xib file.
精彩评论