单击按钮将Json数据传递给其他ViewCont``roller Tableview

时间:2015-03-28 11:34:06

标签: ios

我正在开发一个ios应用程序。点击按钮将Json数组传递给其他UiViewController TableView以在TableView中显示数据...在NSDictionary上使用TableView数组传递并使用字典对象。错误是[__NSCFDictionary objectAtIndex:]:无法识别的选择器发送到实例0x7b115560'] ...在此先感谢

// Button Click 
   BBAuthorDetailViewController *BBAuthorDetail =[[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"BBAuthorDetail"];


        [BBAuthorDetail setSelectionType:BBSelectionAuthorName];
        _serverObj = [[Server alloc]init];

        [_params setObject:_adDetailsObj.authorDetail forKey:@"author"];
        [_serverObj BBAuthorNameWithParams:_params];
     // BBAuthorDetail.data=resultsArray;
    //NSIndexPath *indexPath = [BBAuthorDetail.tableview indexPathForSelectedRow];
           BBAuthorDetail.data = [resultsArray objectAtIndex:indexPath.row];
           NSLog(@"%@",resultsArray);


    //[BBAuthorDetail setManagedObjectContext:self.managedObjectContext];
    [self.navigationController pushViewController:BBAuthorDetail animated:YES];

UIViewController Table TO Show Data

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

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellIdentifier = [NSString stringWithFormat:@"Cell-%li", (long)indexPath.row];
    BBAdsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];


 //   AdDetails *_adDetailsObj = (AdDetails *)[_data objectAtIndex:indexPath.row];
      // NSDictionary  *dic = [_data objectAtIndex:indexPath.row];
    //AdDetails *_adDetailsObj = [[AdDetails alloc]init];

    if (cell == nil) {
        cell = [[BBAdsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        cell.row = indexPath.row;
        //[cell setDelegate:self];
    }
  // Error Part 
    NSDictionary *dic = [_data objectAtIndex:0];  
    cell.textLabel.text = [dic objectForKey:@"post_author"];
    return  cell;
}

0 个答案:

没有答案