2013-04-01 1 views
2

У меня есть больше, чем представление таблицы в контроллере представления, оно дает ошибку. Я понятия не имею, что там происходит, может ли кто-нибудь руководствоваться. Данные не отображаются в табличном представлении, но массив имеет данные при печати на консоли, я пробовал без массива, также предоставляю статические данные в cell.textLabel.text, но не отображается в tableview, количество строк не проверяет там никаких проблем. элемент управления не переходит в cell.textLabel.text, я не понимаю, что не так. Пожалуйста, руководство для вышесказанного. Ниже приведен код:Ошибка [IRForTarget] в UITableView

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell; 

if(tableView == self.mLocationTable) 
{ 
    cell = [self.mLocationTable dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 
    else{ 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 
    // if([self.mLocShowArr count]!= 0) 
    // { 
    // NSString *str = [self.mLocShowArr objectAtIndex:indexPath.row]; 
    cell.textLabel.text = @"locations"; 
    // NSLog(@"show loc:%@", [self.mLocShowArr objectAtIndex:0]); 
    // } 

} 

if(tableView == self.mNotifyTable) 
{ 
    cell = [self.mNotifyTable dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 
    UIImage *yourImage = [UIImage imageNamed:@"emma-watson-02.jpg"]; 
    UIImageView *imageViewToPutInCell = [[UIImageView alloc] initWithImage:yourImage]; 
    imageViewToPutInCell.frame = CGRectMake(5, 8, 55, 55); 

    UILabel *cellTextLabel = [[UILabel alloc]initWithFrame:CGRectMake(68, 10, 200, 40)]; 
    cellTextLabel.text = @"notification view"; 

    [cell addSubview:imageViewToPutInCell]; 
    [cell addSubview:cellTextLabel]; 

} 
} 

Это полная ошибка: Error [IRForTarget]: Вызов символа только функции «objc_msgSend», который не присутствует в мишени.

ответ

0

Вещи для проверки.

  1. методы источника данных все необходимые реализованы
  2. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section журнала возвращаемое значение и убедитесь, что это не 0
  3. Дайте другой идентификатор ячейки для различных таблиц
  4. сделать источник и делегаты данные уверены таблицы являются соединены в бобах

Ошибка Объяснение here

0

Попробуйте этот код !!! В вашем коде вы пропустили «return cell»;

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    cell.selectionStyle = UITableViewCellSelectionStyleBlue; 
    cell.accessoryType = UITableViewCellAccessoryNone; 
} 
    if(tableView == self.mNotifyTable) { 
     cell.textLabel.text = @"locations"; 

     UIImage *yourImage = [UIImage imageNamed:@"emma-watson-02.jpg"]; 
     UIImageView *imageViewToPutInCell = [[UIImageView alloc] initWithImage:yourImage]; 
     imageViewToPutInCell.frame = CGRectMake(5, 8, 55, 55); 

     UILabel *cellTextLabel = [[UILabel alloc]initWithFrame:CGRectMake(68, 10, 200, 40)]; 
     cellTextLabel.text = @"notification view"; 

     [cell addSubview:imageViewToPutInCell]; 
     [cell addSubview:cellTextLabel]; 
    } 
    return cell; 
} 

Надеюсь, что это решает вашу проблему !!!

Примите ответ, если он вам поможет !!!

+0

Нет, я не пропустил это. – 2013-04-01 07:54:52

Смежные вопросы