首先请原谅我的英语,因为我是法国人:-)
我是iOS开发者,我尝试使用XCode 4.4的Master Detail视图.
我想要的是:
我的主视图包含带原型单元格的UITableView.当我点击我的单元格时,我想看详细视图.
这是我的代码:
MasterViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
NSDictionary* instrument = [Instruments objectAtIndex:indexPath.row];
NSLog(@"instrument: %@",instrument);
NSString* status = [instrument objectForKey:@"status"];
NSLog(@"status: %@",status);
NSString* imageName = [NSString stringWithFormat:@"%@48.png", [status lowercaseString]];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
imgView.image = [UIImage imageNamed:imageName];
cell.imageView.image = …Run Code Online (Sandbox Code Playgroud)