【问题标题】:UITableView with UIAlertView带有 UIAlertView 的 UITableView
【发布时间】:2012-07-20 03:17:14
【问题描述】:

我有一个表格视图,我希望您按某个单元格出现警报视图,其中包含每个单元格的个性化数据。 这是代码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString *message=[NSString stringWithFormat:@"%@", [tableViewData objectAtIndex:indexPath.row]];


if (message == @"Juan") {

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Alerta" message:@"Ciudad de México" delegate:self cancelButtonTitle:@"Cerrar" otherButtonTitles:nil];

[alert show];

}

}

你看看我是否按下了显示 Juan 的单元格看到一个 UIAlertView,如果我按下另一个单元格出现 Pedro UIAlertView,如果每个单元格但按下单元格没有出现在 alertview 我错了我希望我能提供帮助并且可以找不到解决办法。

【问题讨论】:

标签: iphone objective-c xcode4


【解决方案1】:

您无法使用 == 测试字符串是否相等,因此您的测试 message == @"Juan" 将始终失败。请改用[message isEqualToString:@"Juan"]。

【讨论】:

猜你喜欢
  • 2013-05-18
  • 2016-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多