【发布时间】:2014-04-19 14:10:43
【问题描述】:
我有一个这样的表格视图。
我所做的是,我为我的单元创建了一个单独的类,并且我在为单元创建的 .m 文件中有 IBAction。
在我的 TableViewController 类中,我有一个由 Web 服务检索的字典。[我正在从中加载这些详细信息。] 现在我想通过单击接受按钮将某些内容发送回我的 Web 服务。
由于我的详细信息字典在 TableViewController 类中,而 IBAction 在单独的类中,我不知道该怎么做。我知道如何做到这一点的逻辑。但我不知道如何从 tableviewControler 的 cellForRowAtIndexPath 方法中的字典变量中获取某些信息..
谁能给我一些想法?请...
编辑:
这里是我的 cellForRowAtIndexPath 方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
TacleCell *cell = (TacleCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSDictionary *tempDictionary= [self.googlePlaces objectAtIndex:indexPath.row];
NSString* FirstName = [[tempDictionary valueForKey:@"PatientProfile"]valueForKey:@"FirstName"];
NSString* LastName = [[tempDictionary valueForKey:@"PatientProfile"]valueForKey:@"LastName"];
//NSString* FullName = [NSString stringWithFormat:@"%@ %@",FirstName,LastName];
cell.Time.text = [NSString stringWithFormat:@"%@ - %@",[[[tempDictionary valueForKey:@"Appointment"]valueForKey:@"DayTimeSlot"]valueForKey:@"StartTime"], [[[tempDictionary valueForKey:@"Appointment"]valueForKey:@"DayTimeSlot"]valueForKey:@"EndTime"]];
cell.Name.text = [NSString stringWithFormat:@"%@ %@",FirstName,LastName];
cell.profileImage.image = [UIImage imageNamed:@"bookmark.png"];
// cell.textLabel.text = [[tempDictionary valueForKey:@"Appointment"]valueForKey:@"AgencyName"];
if([[tempDictionary valueForKey:@"Appointment"]valueForKey:@"AgencyId"] != NULL)
{
cell.Date.text = [NSString stringWithFormat:@"AppoinmentID: %@",[[tempDictionary valueForKey:@"Appointment"]valueForKey:@"AgencyId"]];
}
else
{
cell.Date.text = [NSString stringWithFormat:@"Not Rated"];
}
return cell;
}
在 tempDictionary 中我有一些东西要使用。该值应该通过按接受按钮传递给服务。这就是我想要做的
【问题讨论】:
标签: ios dictionary uitableview