Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在DidSelectRowatineXpath中获取特定textlabel的值并生成json_Ios_Uitableview_Didselectrowatindexpath - Fatal编程技术网

Ios 在DidSelectRowatineXpath中获取特定textlabel的值并生成json

Ios 在DidSelectRowatineXpath中获取特定textlabel的值并生成json,ios,uitableview,didselectrowatindexpath,Ios,Uitableview,Didselectrowatindexpath,以下是MyOrdersController.m文件中我的cellForRowAtIndexPath方法 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = nil; cell = (UITableViewCell *)[tableView dequeueReusableCel

以下是MyOrdersController.m文件中我的cellForRowAtIndexPath方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    UITableViewCell *cell = nil;
    cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@""];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                      reuseIdentifier:nil];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    self.shipmentReferenceNumberTextLabel = [[UILabel alloc]init];

    self.shipmentReferenceNumberTextLabel.text = amountArray[indexPath.row];
    self.shipmentReferenceNumberTextLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:10];


    tableView.tableFooterView = [UIView new];

    cell.layer.borderWidth = 1.0;
    cell.layer.cornerRadius = 10;
    cell.layer.borderColor = [UIColor blackColor].CGColor;

    [cell.contentView addSubview:self.productAmountLabel];
    [cell.contentView addSubview:self.productAmountTextLabel];

    return cell;
}
我有一个textlabel
ShipmentReferenceNumber textlabel
。当用户单击特定单元格时,我必须获取
shipmentReferenceNumber
的值,并且我必须在一个名为APIRequest.m的文件中使用它发出json请求。我试图抓住它的价值如下

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
    tabBar = [self.storyboard instantiateViewControllerWithIdentifier:@"TabBarController"];
    [self.navigationController pushViewController:tabBar animated:YES];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    MyOrdersController *detailVC = [[MyOrdersController alloc]init];
    NSLog(@"%@",  detailVC.shipmentReferenceNumberTextLabel.text);

}

问题是,当我试图获取它的值时,它的打印
null
。如何解决此问题。

您可以从数组中获取标签的值

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
      NSLog(@"%@",amountArray[indexPath.row]);
}

您将获得所选行的标签值。

您可以从数组中获得标签值

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
      NSLog(@"%@",amountArray[indexPath.row]);
}
您将获得选定行的标签值