0

从 tabelview 发送文本到标签和数字到 int 到 viewcontroller 但它不工作

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    pushnavViewController *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"pushnavViewController"];

    [self.navigationController pushViewController:detailViewController animated:YES];
    detailViewController.pushh.text = [IDNum objectAtIndex:indexPath.row];
    detailViewController.pushh.text = [listt objectAtIndex:indexPath.row];
}

我也尝试过这样做,但没有工作:

detailViewController.pushh.text = [IDNum objectAtIndex:indexPath.row];
detailViewController.pushh.text = [listt objectAtIndex:indexPath.row];
[self.navigationController pushViewController:detailViewController animated:YES];

我制作了所有属性并合成了它们:

@property (nonatomic) UILabel *pushh;
@property (nonatomic) UILabel *IDnumber;

那么,有什么想法吗?

    NSArray *listt,*IDNum;
4

1 回答 1

1

好吧,对于一个你正在使用detailViewController.pushh.text的两个任务。我相信应该是detailViewController.IDnumber.text第一个。其次,在加载视图之前,您不能更改.text标签的属性。

相反,创建一个NSString属性并将您的信息保存到NSString,然后在您的viewDidLoad方法中pushnavViewController分配属性label.text的值NSString

于 2012-06-29T18:30:51.270 回答