2012-02-02 4 views
0
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return self.nameList.count; 

} 
-(UITableViewCell *)tableview:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 

    static NSString *[email protected]"Cell"; 

    UITableViewCell *cell=[tableview dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell==nil) { 

     cell=[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]; 
     //cell = [[UITableViewCell alloc] 
     // initWithStyle:UITableViewCellStyleDefault 
     // reuseIdentifier:CellIdentifier]; 

    } 
    //Setup the cell 
    NSString *cellValue=[ListofItems objectAtIndex:indexPath.row]; 
    cell.text=cellValue; 
    cell.textLabel.text = [self.nameList    objectAtIndex: [indexPath row]]; 

    return cell; 

} 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
    return 1; 
} 

Привет, ребята, У меня есть эти коды, и я не могу видеть мои ценности в моем tableview.?And он говорит, что это: «программа получила сигнал SIGABRT» Можете ли вы помочь мне, где моя ошибка?Ошибка при загрузке UITableView

ответ

0
return self.nameList.count; 

который является значением nameList.count, когда вызывается номер таблицы видаOfRowsInSection? Постарайтесь установить его на фиксированное значение только для проверки. Может быть, вы не устанавливаете namelist должным образом.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return 1; 

} 
+0

Да, спасибо .. Теперь все в порядке – santa