I'm new with the objective-c programming, but so far i manage to do a custom splitview which parse an rss link of news list in tableview on the rootview. When the link selected it will open the url in detailed view.The problem is i can only show the full html in uiwebview. What i want is that the detail view to display only text and the image (just like the BBC-News app), I tried the stringWithContentsOfURL and stripped the html tag, but it display the whole string from head to footer. I just wanted the body content. Is there anyway i can achieve that? Thanks in advance.
If you use the XMLParser then you should apply didStartElement method use this method and make a check for what ever part you want with simple syntax
if([elementName isEqualToString:#"body"])
use this type of if/else check to refine what ever that you want and save in an array according to your data Class then when you retrive data at the time of detail view use this array and tie with particular data whatever you want to show in your details view.
Like:-
label.text = array.title;
Hope this will help you...
Related
Hi i am developing one application using UITableview. My requirment is to click the tableview cell to navigate detailview controller and display corresponding PDF File.
I have completed UITableview coding. My requirement is using json parser to access the corresponding PDF URLS to display the data.
so plz any body help how to develop the code using json parser to display corresponding tableviewcell pdf file. Send me any sample code.
Thanks in advance.
You Must Do Following Steps
Study About JSON Parser and Store Values to Corresponding Arrays.
Using This Array Values and Fill the Tableview Cells.
Then click the DidSelectRow you can get corresponding Array value using IndexPath.row, then Pass values to Another View controller.
The PDF viewConroller You can display PDF in the WebView.
Here is an interesting tutorial by Ray which explains well about json and how to use in application
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 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 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 have a controller Employee , in that i have the action detail . The detail action prints like the attached image.alt text http://www.freeimagehosting.net/uploads/7bfae5ce57.png
Suppose there is a save pdf button, i need to print this page as .pdf.. How can i do this ? Pls help me
Thanks in advance
Nisanth
Probably you would need to implement another view to Detail action, which would use all given information (as it does now for printing HTML) to create a PDF document. Then you could use Context Switch action helper to trigger using PDF View instead of what is displayed now.