我是iOS新手.我在ViewControllers之间传递数据时遇到问题.我有三个viewControllers(view_1,view_2和view_3).
在这里我的设置: -
我想将'view_1'的ViewController引用(id)发送到'view_3'.所以我包含include "view_3"在'view_1'中并将值设置为'view_3'变量(使用view_3 *v3=[[view_3 alloc] init ]; v3.reference=self;).在控制台中显示:
查看控制器: - ; <ViewController:0x89e9540>
在'view_1'但在'view_3'中,在它显示的控制台中
视图控制器(null)
但是当我使用'view_2'传递这些数据时它的工作.但是怎么样?我想知道这种行为,是否有任何解决方案来创建这个?
请帮忙.
首先请原谅我的英语,因为我是法国人:-)
我是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)