gpt4 book ai didi

ios - 条件不工作

转载 作者:行者123 更新时间:2023-11-29 12:09:11 25 4
gpt4 key购买 nike

我使用 ViewController 中的按钮转到 TableViewController。在 TableViewController 中,我创建了 int NInt1。但是当我转到 TableViewController 时,条件不起作用。

ViewController.m

- (IBAction)Button:(id)sender {
MasterViewController *trns =[[MasterViewController alloc]init];
[_Button.titleLabel.text isEqualToString:@"1"];
trns.NInt1=1;
}

TableViewController.m

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(_NInt1 == 1){
return 5;
}else{
return 20;
}
}

最佳答案

如果您正在使用故事,请像这样传递值:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
RecipeDetailViewController *destViewController = segue.destinationViewController;
destViewController.NInt1 = 1;
}

现在在目标 View Controller 的 viewDidLoad 中查看 NInt 的值。

关于ios - 条件不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33995503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com