Hi everyone, I'm new to this as I come from C++ and Perl background. Trying to learn from books but they are missing some core concepts of Objective-C. I need some help on this code to pull a webpage:
RootViewController.m
This code works just fine but what I'm having trouble is calling this method from another class, like the code below:Code:- (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]; }
AnotherViewController.m
I click on the button on the table view and I see the code is being called in the RootViewController with the NSLog but it doesn't seem to display the new page. Any ideas? ThanksCode:- (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]; }



LinkBack URL
About LinkBacks
Reply With Quote