저는 C++ 및 Perl 배경에서 온 것부터이 기능을 처음 사용합니다. 책에서 배우려고하지만 Objective-C의 핵심 개념이 빠져 있습니다. 나는 웹 페이지 끌어 코드에 약간의 도움이 필요합니다 :iPad iPhone : View View Controller에서 Webview 호출
RootViewController.m을
- (void)fetchWebsite:(NSString*)website{
NSLog(@"address: %@", website);
NSString *urlAddress = website;
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webImageDisplay loadRequest:requestObj];
[webImageDisplay release];
}
- (void)viewDidLoad {
[self fetchWebsite:@"website here"];
[super viewDidLoad];
}
이 코드는 잘 작동하지만 나는이 문제에 봉착하는 등, 다른 클래스에서이 메서드를 호출입니다 코드 아래 :
내가 제대로이 같은 2 차 뷰 컨트롤러에서 상세 뷰 컨트롤러 전화 해요 :
SubViewController.m을
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
switch (indexPath.row) {
case 0: {
AnotherViewController *cViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherViewController" bundle:nil];
cController.contentSizeForViewInPopover = CGSizeMake(320, 350);
[self.navigationController pushViewController:cViewController animated:YES];
[cViewController release];
break;
}
case 1: {
break;
}
}
}
그런 다음 웹보기에 표시하려는 새 웹 페이지에 대한 링크가있는 세 번째보기 컨트롤러가 있습니다. RootViewController에서 함수에 액세스하기 위해 여기에서 메서드를 호출하면 응답하지 않는 것 같습니다.
AnotherViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *itemRequested = [conusItems objectAtIndex:indexPath.row];
NSLog(@"logging: %@", itemRequested);
RootViewController *parent = [[RootViewController alloc] init];
[parent fetchWebsite:@"another website here"];
[itemRequested release];
}
나는 테이블 뷰에있는 버튼을 클릭 나는 코드가 NSLog와 RootViewController에서 호출되고 있는지 볼 수 있지만이 새로운 페이지를 표시하지 않는 것 . 오류나 경고 없음, 어떤 아이디어? 감사합니다
죄송합니다 정교하지 않기. 이 일을 http://mobiforge.com/designing/story/using-popoverview-ipad-app-development 할 노력하고있어하지만 세 번째보기 컨트롤러가 올바르게 rootController에서 끌어 오기 webview 호출 할 수없는 것 같아요. 새 페이지. –