好吧,我有 2 个 plist 文件:
和:
我的故事板是:
问题是当在我的“Inicio”视图控制器中从 plist 加载数据时,我希望在具有 ENABLE=NO 属性时禁用单元格并启用具有 ENABLE = YES 的单元格,当我按下或单击单元格时,然后转到此视图控制器中的下一个视图控制器“PERSONAS”加载第二个 Plist,在同样的情况下,我只想使用 plist 中启用的已启用单元格进入“DETALLE”视图控制器。
对于我使用的每个 viewdidload:
NSString *myListPath = [[NSBundle mainBundle] pathForResource:@"MainMenuList" ofType:@"plist"];
mainMenu = [[NSArray alloc]initWithContentsOfFile:myListPath];
NSLog(@"%@",mainMenu);
NSString *myListPath = [[NSBundle mainBundle] pathForResource:@"PersonasList" ofType:@"plist"];
Personas = [[NSArray alloc]initWithContentsOfFile:myListPath];
NSLog(@"%@",Personas);
为了在自定义单元格中显示表格视图,我使用:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"CustomCell";
NSLog(@"CARGANDO CELDAS");
MainMenuCell *cell = (MainMenuCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCelliPhone" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
//CustomCell*cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
cell.Enabled.text = [[mainMenu objectAtIndex:indexPath.row]objectForKey:@"ENABLE"];
cell.TitleLabel.text = [[mainMenu objectAtIndex:indexPath.row]objectForKey:@"NAME"];
cell.ImageImageView.image = [UIImage imageNamed:[[mainMenu objectAtIndex:indexPath.row]objectForKey:@"IMAGE"]];
if ([cell.Enabled.text isEqualToString:@"NO"])
{
NSLog(@"%@",cell.Enabled.text);
cell.userInteractionEnabled = NO;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.selected = NO;
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
在 Persona 视图控制器中,我使用相同的代码但无法正常工作,所有自定义单元都已启用,我该如何解决?或者我有什么问题?或者我确实忘记了一些东西,请帮助大家!
在模拟器中以这种方式运行以启用:
但我不想让 ENABLE NO 运行的单元格!!:
请帮助大家,我使用 XCODE 5 DP6,对于 iOS7,解决这个问题的最佳方法是什么!!!谢谢!!!!