Xcode显示UITableRowSelection后的UIAlertView?
这是我的第一个问题,对不起,如果有什么不对
那么我想创build一个视图,我可以从表视图中select一个朋友,然后它应该说一个UIAlertView的数量和邮件,但我不知道如何做这个朋友列表是从一个XML文件在我的网站上,然后parsing一个表格上显示一个自定义的单元格devise
这是创build每个单元格的代码
- (UITableViewCell *)tableView:(UITableView *)myTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (UITableViewCell *)[self.messageList dequeueReusableCellWithIdentifier:@"ContactListItem"]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ContactListItem" owner:self options:nil]; cell = (UITableViewCell *)[nib objectAtIndex:0]; } NSDictionary *itemAtIndex = (NSDictionary *)[messages objectAtIndex:indexPath.row]; UILabel *userLabel = (UILabel *)[cell viewWithTag:2]; userLabel.text = [itemAtIndex objectForKey:@"user"]; return cell; }
感谢圣地亚哥
你必须实现didSelectRowAtIndexPath:
方法。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *itemAtIndex = (NSDictionary *)[messages objectAtIndex:indexPath.row]; NSString *name = [itemAtIndex objectForKey:@"user"]; NSString *email = [itemAtIndex objectForKey:@"email"]; NSString *phone = [itemAtIndex objectForKey:@"phone"]; NSString *messageStr = [NSString stringWithFormat:@"Email : %@\nPhone : %@", email, phone]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:name message:messageStr delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; }
– (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath是您需要实现的方法。 这是假设您正在呈现表视图的视图是表视图的委托。
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //Alert view logic happens here getting all the cell information }
- 对<TSActivityMapVC:0x81b1000>开始/结束外观转换的不平衡调用
- 添加一个属性到我所有的UIControls
- SocketRocket试图安装socketrocket后,我可以让PonyDebugger工作,我得到3个苹果Match-O链接器错误
- 是否有可能在同一个项目中同时拥有iOS应用程序和Mac应用程序?
- 坚实的解决scheme,以基于子视图灵活调整UIView的大小
- 在以编程方式创build视图时,我应该在哪里设置自动布局约束
- 使用NSString将UTF-8编码转换为ISO 8859-1编码
- NSFetchedResultsController的节名称与pipe理对象值不匹配
- iOS:UITableViewController – cellForRowAtIndexPath单元格创build