|
|
#51 |
|
I got the table view to populate by taking this code out of KFBAppDelegate and putting it into the code for the button in KFBViewController.
Code:
ListViewController *lvc = [[ListViewController alloc]initWithStyle:UITableViewStylePlain];
WebViewController *wvc = [[WebViewController alloc]init];
[lvc setWebViewController:wvc];
I'll be back when I either figure it out or need more help. |
|
|
|
0
|
|
|
#52 | ||
|
Quote:
Quote:
__________________
|
|||
|
|
0
|
|
|
#53 |
|
Here is the code in ListViewController that uses the web view:
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Push the web view controller onto the navigation stack - this implicitly creates the web view controller's view the first time through
[[self navigationController]pushViewController:webViewController animated:YES];
// Grab the selected item
RSSItem *entry = [[channel items]objectAtIndex:[indexPath row]];
// Construct a URL with the link string of the item
NSURL *url = [NSURL URLWithString:[entry link]];
// Construct a request object with that URL
NSURLRequest *req = [NSURLRequest requestWithURL:url];
// Load the request into the web view
[[webViewController webView]loadRequest:req];
// Set the title of the web view controller's navigation item
[[webViewController navigationItem]setTitle:[entry title]];
}
As far as the debugging that led me to fix the table view, it was a combination of adding break points, adding the NSLog statement in order to see what the count was, and what chown33 mentioned about some things in the AppDelegate file. |
|
|
|
0
|
|
|
#54 |
|
Don't forget to also fix your linked images bug I mentioned earlier.
__________________
|
|
|
|
0
|
|
|
#55 |
|
|
0
|
|
|
#56 | |
|
Quote:
P.S. Any progress on your latest bug?
__________________
|
||
|
|
0
|
|
|
#57 |
|
Thanks and no I haven't been able to dive into the new bug yet.
|
|
|
|
0
|
|
|
#58 |
|
I did put a break point here and the application stopped running when I selected a row in the table view.
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Push the web view controller onto the navigation stack - this implicitly creates the web view controller's view the first time through
[[self navigationController]pushViewController:webViewController animated:YES];
// Grab the selected item
RSSItem *entry = [[channel items]objectAtIndex:[indexPath row]];
// Construct a URL with the link string of the item
NSURL *url = [NSURL URLWithString:[entry link]];
// Construct a request object with that URL
NSURLRequest *req = [NSURLRequest requestWithURL:url];
// Load the request into the web view
[[webViewController webView]loadRequest:req];
// Set the title of the web view controller's navigation item
[[webViewController navigationItem]setTitle:[entry title]];
}
|
|
|
|
0
|
|
|
#59 | |
|
Quote:
P.S. I would suggest waiting to push the new controller until you've done the setup. Just seems like a more logical progression of steps.
__________________
|
||
|
|
0
|
|
|
#60 |
|
I added some NSLog statements to that delegate method to verify that it is getting the URL when a row is selected. It is getting the URL. Here are the results:
2012-10-29 15:19:26.539 KFBNewsroom[3697:c07] Link: http://kyfbnewsroom.com/2012/10/22/r...votes-matter-2 2012-10-29 15:19:26.540 KFBNewsroom[3697:c07] URL: http://kyfbnewsroom.com/2012/10/22/r...votes-matter-2 2012-10-29 15:19:26.547 KFBNewsroom[3697:c07] Request: <NSURLRequest http://kyfbnewsroom.com/2012/10/22/rural-votes-matter-2/?utm_source=rss&utm_medium=rss&utm_campaign=rural-votes-matter-2> |
|
|
|
0
|
|
|
#61 | |
|
Quote:
I find it is always a good idea to check if variables are nil when they shouldn't be. That frequently causes the app not to do what you expect it to do, because you are calling methods on a nil object, which is simply ignored.
__________________
|
||
|
|
0
|
|
|
#62 |
|
I'm not really sure what other ones to check.
|
|
|
|
0
|
|
|
#63 |
|
Your delegate method contains references to 13 properties or variables, that I can see. Have you checked them all?
__________________
Last edited by dejo; Oct 29, 2012 at 03:40 PM. Reason: Updated count. |
|
|
|
0
|
|
|
#64 |
|
Unless I've missed something, yes, I've checked them.
|
|
|
|
0
|
|
|
#66 |
|
The only property in that line is webViewController. Other properties in that method are webView, title, items, title, and link.
|
|
|
|
0
|
|
|
#67 |
|
What is this?:
Code:
[self navigationController]
__________________
|
|
|
|
0
|
|
|
#68 |
|
|
0
|
|
|
#69 |
|
What kind of element is navigationController?
Yes, in this case it's a method call to an accessor, but in the overall scheme of things what is navigationController in relation to your ListViewController, which is a subclass of UITableViewController, which itself is a subclass of UIViewController? It's a property, as can be seen in the UIViewController Class Reference. So, what is the value of navigationController when you try to push the web view controller onto the navigation stack?
__________________
|
|
|
|
0
|
|
|
#70 |
|
I replaced
Code:
[[self navigationController]pushViewController:webViewController animated:YES]; Code:
[self presentViewController:webViewController animated:YES completion:nil]; I still have some things to figure out but I think I can work through them. Thanks guys! |
|
|
|
0
|
|
|
#71 |
|
Yeah, in order to ease navigation, you'll probably want to integrate a UINavigationController at some point. I'd suggest right from the beginning and then push new view controllers onto the stack as you drill down. You might have a look through the entire View Controller Programming Guide for iOS to understand what your options are.
P.S. Care to tell us what made you come to that decision?
__________________
Last edited by dejo; Oct 30, 2012 at 06:54 PM. Reason: Added P.S. |
|
|
|
0
|
|
|
#72 |
|
I've added this code to KFBAppDelegate and now I'm not sure how to push the navigationcontroller to the other views.
Code:
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[KFBViewController alloc] initWithNibName:@"KFBViewController" bundle:nil]];
self.window.rootViewController = nav;
Code:
[[self navigationController]pushViewController:webViewController animated:YES]; Here is the current project without the navigation controller code put in the appdelegate file for reference. https://www.dropbox.com/s/sv0y3oh1af...wsroom%204.zip |
|
|
|
0
|
|
|
#73 |
|
You think? What have you tried? If you continue to guess at solutions, I'm not sure I can be of help anymore.
P.S. You seem to have a tab-bar app. You should be setting your rootViewController to a UITabBarController.
__________________
|
|
|
|
0
|
|
|
#74 |
|
I'm wanting to have a tab bar with a home item and a couple of items that go to other views but I also want a navigation bar with a back button.
|
|
|
|
0
|
|
|
#75 |
|
Alright. What do you know about combining a tab-bar-based app with a navigation-based one? If not much, how are you planning on learning about it?
__________________
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 04:07 AM.







I support the
Linear Mode
