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.
Related
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.
Good afternoon. I would like to know if there is a method that makes the text-field capable of "remember" what the user wrote the previous times, so when the user writes the first letter a list with the proposed words will appear!! :) Thanks!
It can possible to show the list of values in tableview. you can use autocomplete.
Read this article. and also with source code. This will help you.
Sample image
Not that easy, you will have to do some modifications, for example you will need to store in an NSMutalbeArray all the value inserted, then you will have to present a table when the user starts to edit the UITextField this will change as the user writes
as your app runs, there will be many text that you need to remember/store that it will come to the point that your text that you have to remember will grow to size. you can store your text to a local database (sqlite), then as the user writes on the text field, do a search query and return the data.
unless you dont want to remember the text entered when the user used and exited/quit your app.
My app has a UIWebView that is used for showing a PDF file. The file size is less than 1MB but when the user double taps the screen, the app freezes and crashes a few moments later.
I think that if I disabled the select function, maybe this problem wouldn't occur. How do I do that?
Have a look at the console output. It looks like you are not handling tap events properly. You must have those handlers even if you want to ignore tap events (i.e. do nothing and return).
Here's a good overview of what needs to be done:
http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/
i got an rss feed app. All is working ok apart from the fact that in my "description" textView
(detail of the rss) the text appears in html!
any ideas in what is going on?
thanks!
i have found the solution using a wbview with loadHTMLString.
however i would like to ask what is the difference between these two rss feeds:
http://newsrss.bbc.co.uk/rss/sportonline_world_edition/front_page/rss.xml
and this for example:
http://feeds.feedburner.com/pitsirikos/uPfN
in the first one i can get the textview to display the contents as they should appear while in the second one i get html code in the textview!
my code remains the same in both cases...
The key difference between them is that the latter contains prefix tags
e.g. and
Do you use NSXMLParser or libxml2 ? are you doing a strcmp with the element name ?
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.