iphone - UITableView pushViewController On Selecting a Row -
I am creating an iPhone app with UITableView, when I select a row, let me load a specific URL to a UIWebView To be pushed in
How can I get a new view that slides up to include a UIWebView and later loads the story link through it: As other people have said, the general idea is to first place a property on the ViUI controller, which is the URL Loads the need to load, and then loads that URL into the UIWebView when the view appears. This example is how it might look, starts with the header: for implementation now: So now that you need to do in the controller for the previous view, it will receive the story URL, first give it to the View Controller and press it. And there are some other points about it: I think the "link" The value is already a string - If this case was unnecessary to build a brand new string in your original example. As you can see in my example, we can use this string to create a In your original code, when you turn alloc / your FirstViewController, you can pass it directly to - (zero) table view: (UITableView *) was the TableView SelectionRowAtIndexPath: (NSIndexPath *) indexPath {NSDictionary * story = [Stories { : [Index path line]]; NSString * storyLink = [NSString stringWithFormat: [story objectForKey: @ "link"]]; [[Self-Navigation Controller] PushviewController: [[FirstviewConverterAloc] Init Whitneynames: @ "Firstview" Bundle: [NSBindle Main Bundle]] Animated: Yes]; }
@implementation FirstViewController @synthesize webView; @ Synthesis storyURL; - (zero) DLok; {[Wordline release]; // Do not forget to leave this [super delok]; } - (zero) viewDid you: (BOOL) animated; {// When the view appears, create the URL request from the story URL and load it in the web view. NSURLRequest * Request = [NSURLRequest request with url: self.storyURL]; [Self. Webw load request: request]; } - (zero) viewviewYou: (BOOL) animated; {// There is no point in continuing with any request load // If anyone left this screen before the screen expires [self. VV Weaver Stoplogging]; } @end
- (zero) table view: (UITableView *) table was viewed SelectionRowAtIndexPath: (NSIndexPath *) indexPath {NSDictionary * story = [Stories ObjectOut Index: [Index Path line]]; NSURL * storyURL = [NSURL URLWithString: [story objectwork: @ "link"]]; First ViewController * First visual controller = [[[FirstviewConverter alloc] initWithNibName: @ "Firstview" bundle: [NSBindal main bundle]]; // I am absolutely sure that you do not have to go to the main bundle in the first bundle first, ViewController.storyURL = storyURL; [Self. Navigation controller Push ViewController: Animated first viewer: Yes]; [First weekant release]; // do not remember memory}
NSURL
example directly. pushViewController
. This creates a memory leak because once the UINavigationController
is done with it (later the navigation stack stops), it retains 1. At least you have to autorelease
but the most effective thing to do here is that it is aloc / int, it stores it in a temporary variable, then it is directly to release
After it is pressed, call it ensures that once the navigation stack closes, it will be deallocated.
Comments
Post a Comment