2
在我的tableview上执行搜索并选择一行后,详细视图控制器(MOVdetailViewController)只更新名称而不是信息(地址,网站和其他东西)。它位于我设置为开关的MDVC.lodgeNumber中。我现在认为这是不可能的,因为详细信息存储在交换机中。所有的反馈是极大的赞赏开关prepareForSegue函数不返回搜索后的原始切换结果
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"lodgedetail"]) {
MOVDetailViewController *destViewController = segue.destinationViewController;
MOVDetailViewController * MDVC = [[MOVDetailViewController alloc] init];
NSIndexPath * path = [self.tableView indexPathForSelectedRow];
NSString * thelodge = [filteredList objectAtIndex:path.row];
MDVC = [segue destinationViewController];
MDVC.lodgeNumber = path.row;
MDVC.lodgeName = thelodge;
NSIndexPath *indexPath = nil;
if ([self.searchDisplayController isActive]) {
indexPath = [self.searchDisplayController.searchResultsTableView
indexPathForSelectedRow];
destViewController.lodgeName = [filteredList objectAtIndex:indexPath.row];
} else {
indexPath = [self.tableView indexPathForSelectedRow];
destViewController.lodgeName = [lodgeList objectAtIndex:indexPath.row];
}
}
}
例子:
self.title = lodgeName;
switch (lodgeNumber) {
case 0:
//Abingdon Lodge No. 48
address.text = @"325 W Main Street Abingdon, Virginia 24210";
website.text = @"http://www.grandlodgeofvirginia.org/lodges/48/";
statedc.text = @"Abingdon Lodge No. 48 holds it's stated communication on the
2nd Monday of the month at 7:30 PM. If there are
any exceptions to the regular meeting day or time,
they are posted on the Lodge website.";
lodgehistory.text = @"According to the earliest records the Abingdon Lodge had
its origin “At a meeting held at the house of
James White in the town of Abingdon, on October 3, 1796.” The record
states that a dispensation had been given by the Grand Master of
Masons in Virginia and the following were present: William King,
Master; Daniel Murphy, Past Master; Robert Johnson, Past Master;
Charles Carson, Past Master, and William Preston Skillern. For more
information on the Lodge History please see the Lodge website.";
break;
查希尔·艾哈迈德,你知道这是可能的吗? – Apps
哪个方法包含'switch'语句? –
(lodgeNumber).... tableview保存旅馆的名称,详细视图保存LodgeNumber,它保存用户执行搜索后不更新的信息。切换方法是(lodgeNumber)但是,self.title AKA lodgeName正在更新。我不确定为什么其他数据不是。确定后,详细数据只显示情况0,而不显示其他情况。 – Apps