안녕하세요, 현재 iPhone SDK를 사용하고 있는데 NSString을 3 개보기로 전달하는 데 문제가 있습니다3 개의 ViewController를 통해 NSString을 전달하는 방법은 무엇입니까?
NSString을 2 개의보기 컨트롤러간에 전달할 수는 있지만 다른 항목을 통해 전달할 수 없습니다. 다음과 같이 내 코드 "의 ViewController 2"구현에
`- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)index`Path {
NSString *string1 = nil;
NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"items"];
string1 = [array objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
ViewController2 *vc2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:[NSBundle mainBundle]];
vc2.string1 = string1;
[self.navigationController pushViewController:vc2 animated:YES];
[vc2 release];
vc2 = nil;
}
내가 다음 ....
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = string1;
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"icon_time.png"]
style:UIBarButtonItemStylePlain
//style:UIBarButtonItemStyleBordered
target:self
action:@selector(goToThirdView)] autorelease];
self.navigationItem.rightBarButtonItem = addButton;
}
하지만를 수행하여 제목 표시 줄에 수 사용 "문자열 1을"나는 ...이다 또한 내가
- (void)goToThirdView
{
ViewController3 *vc3 = [[ViewController3 alloc] initWithNibName:@"ViewController3" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:NESW animated:YES];
vc3.string1 = string1 ;
[vc3 release];
vc3 = nil;
}
는 어떻게 세 번째보기에 같은 문자열을 통과 할 새보기를 밀어 싶습니다 오른쪽에 Navbar의 버튼이 있습니까? (또는 네 번째)