gpt4 book ai didi

iphone - 我如何使用相同的导航 Controller 从不同的单元格转到不同的 View Controller ?

转载 作者:行者123 更新时间:2023-11-28 20:45:23 25 4
gpt4 key购买 nike

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath    *)indexPath
{
[[tableView cellForRowAtIndexPath:indexPath] setSelected:NO animated:YES];

if(indexPath.section==0)
{
if([array1 objectAtIndex:0])
{
BirthDateController *yeniSayfa=[[BirthDateController alloc] init];

yeniSayfa.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:yeniSayfa animated:YES];

[yeniSayfa release];
}
}
}

我只希望 array1 中的第一个项目进入此 BirthDate 模态视图,但现在所有第一部分都使用此模态视图。任何人都可以帮助我只制作第一部分的第一个单元格打开此模态视图.

最佳答案

I want only the first one the first item in the array1 to go this BirthDate modal view but now all the first section is using this modalview.

如果我没理解错的话,你指的是第一部分的第一行。然后,像这样更改您的条件:

if( indexPath.section == 0 && indexPath.row == 0 ) {

生成的代码如下所示:

if( indexPath.section == 0 && indexPath.row == 0 ) {
BirthDateController *yeniSayfa=[[BirthDateController alloc] init];
yeniSayfa.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:yeniSayfa animated:YES];
[yeniSayfa release];
}

内部if:

if([array1 objectAtIndex:0])

对我来说确实有意义。除非 array1nil(或引发异常),否则它将评估为 true。 objectAtIndex: 不能返回 nil 因为 NSArray 不能存储 nil 值并且如果索引超出末尾的数组,它会引发 NSRangeException

关于iphone - 我如何使用相同的导航 Controller 从不同的单元格转到不同的 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6613736/

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