I am displaying RSS feeds in my table view.
as there are hundred of feeds so my application takes lots of time to load them and display them i want to load just first 25 feed and display them in Table view and when User Click on More 25 application load next 25 and display them.
Any Idea........... :)
I am using TouchXML to parse XML Feed.
It depends on the webservice that provides you the RSS feed. If you can request them to load just 25 feeds, then the server side is ok
Now is the client side, you need a UITableView as usual. In the numberOfRows delegate method, you return 25 (also need to +1 for last cell), and shows the first 25 feeds. At the bottom of the table view the last cell can be a cell with text "Load More", then here, you started to load more
You can also put the loading and parsing RSS feed in thread, this will boost your performance
While parsing if you encounter a feed store it in a arry... if the array count is 25 display display it in table view continue parsing if the user click on more button display next 25 elements in the array to the tableview.
as vodkhang told Use thread if you want to boost performance.
Take a look at the SeixmicXML example and the LazyTableImages sample code on the apple developer web site. They use threading (NSOperation) for parsing batches of data and load them on a table view.
Related
I am working on some kind of tab functionality in my app so the user can switch between web pages they have open just like in any browser.
Is it possible to have a page loaded in one webview and then transfer the data to a second web view so it can be displayed without requiring the user to re-download the page?
Thanks.
Is it possible to have a page loaded in one webview and then transfer the data to a second web view so it can be displayed without requiring the user to re-download the page?
Instead of doing this, why don't you swap your first and second web view? So, the first web view would replace the second (it would not need to be reloaded), and then you would download a second page in the latter.
As an aside, you could copy the content of the first web view into the second by doing:
NSString* body = [webView stringByEvaluatingJavaScriptFromString:#"document.body"];
then:
[secondWebView loadHTMLString:body baseURL:nil];
but this would not be very efficient: the HTML would not be downloaded a second time, still it should be rendered by the second web view (and this would cost some time, so you would have a delay). Much better to swap the web views.
Simply.. that's not possible. As far as i know is not possible to share data between different instance of UIWebview
I am working on an example project for learning purposes. I have successfully parsed a wordpress site by parsing RSS feed using NSXMLParser. The custom cell includes thumbnail, title, author and published date of posts.
Currently its showing the first page of feed containing 10 posts. I can access the second page of the feed http://sitename.com/feed/?paged=2 and and third page by putting /?paged=3, if i type them in the browser.
What i want to do is when user scrolls down to the bottom, it uses the second page feed url and show the posts at the bottom and so on. Can anyone guide me how to accomplish this task.
Coneybeare has the right idea on how to set it up.
Use AFNetworking, it'll make your life way easier.
I would have an int counter that keeps track of which URL has been last called. Then, as soon as the user gets to the bottom most cell (which you know via a delegate method), I would increase the int by 1, and then append that to the String that represents the URL. You can use the stringByAppendingString method for that.
Now you have a new String with the correct url, and you can fire off a new request, and append the data to what you already have. Then you can do [self.tableView reloadData] to refresh the table.
To make an infinite scroller, you need to know when to start fetching the new items. There are many ways to do this, but the best place is to hook into the UITableViewDelegate's methods. When cellForRowAtIndexPath: is called, check if the row is the last in your data store. If it is, make the call for the new data, then append it to the old data and refresh your view. You can also hook into the table views scroller to see when it it X percent scrolled to the bottom to make this call.
I am just building an app for my first time. I've created it so that I open it and it opens web view and I have a button called "Save" (so it's just a web view inside the app with a little button below it). I would like to be able to save a website when I visit it. It doesn't need to label the save or anything, I just want it to save and I can click another button called "sites" and it will display my list of saved websites.
You will have to decide on some kind of storage method. A simple one would be create an NSMutableArray of the sites. Depending on the needs of the application, you could change this to something different. Then, saving the site is as simple as inserting an object that represents the page (maybe an NSURL or an NSString with the URL). The question Get current URL of UIWebView discusses several ways of getting a URL from a webview. You can then decide on a way to display the list of saved sites. Once a site is selected, you just have to pass it back to the webview.
I have an rss feed with only one item in it.I am trying to go straight to showing its details without having to go through a table view to do it.
I have a different rss feed working in my app that has multiple items. I have this working with a table view.I was looking online and all I could find was how to display a feed through a table view.
Does anyone know how to display the singular item from the feed in an app?
or of any online tutorials?
Any and all help much appreciated.
Just parse the feed and insted of showing in tableview ,show it in a label or textview .
I don't understand what u trying to ask through your question. It sounds simple but can you elaborate or give url of Rss feed links for understaning ur query...
If you've parsed your data already, you have it stored in a set of variables, right?
So now you just want a particular data to display in detail view for this if you use (UIWebView for DetailView) used this or a particular you wish to publish in the details view:-
– loadHTMLString:baseURL:
Sets the main page content and base URL.
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
Parameters
string
The content for the main page.
baseURL
The base URL for the content.
k...
I am new to iPhone development. I am parsing a URL and displayed its content in the table. On clicking a row it plays a video. When I click a done button, I once again call the tableview.
When I call the table view it parses the URL once again to display the contents. I want to limit the parsing for 1 time and for the next time I want to display the contents which are parsed at the first time. How can I achieve it?
Not to sound condescending, but, don't do that? When the results are first requested, parse them and store the parsed results. From there on out, only return those.
Without more information about your problem, it seems that trivial.