Creating a Scroll View that pulls all data from an xml file - ios

I am trying to create a "simple" photo ID app. The final product would be a series of images in a scroll view that you can click on to get more information. The images and data pertaining to the images, are all stored on a website in an XML file.
I can create an app that loads the xml into a table view, with the xml item title as the cell label, then when you click on the cell, a detail view is shown with the remaining details about the item. I can load and parse the xml into the table view without much issue. I cannot, it seems, translate this process into a scroll view app. I followed this tutorial, and a few others like it, to achieve that result.
I have looked at the apple supplied examples of UIScrollView and several dozen YouTube videos and blog tutorials on the subject of implementing a scroll view, however I have yet to find any documentation on having the data pulled from xml. The scroll view is also going to be paging so the number of pages in the scroll view need to dynamically load from the number of items contained in the xml (similar to how the tableview knows how many rows to created based on item count).
I have made a scroll view app that loads 3 pages at a time and loops, like in this tutorial. (Half way down there is a section labeled 3 Pages Only.) This app, along with the Page Control sample that Apple provides, defines the number of pages that are to be displayed, they don't pull from the plist or xml data how many items there are and adjust accordingly.
I don't know that my existing code will be of any use to anyone as it's almost identical to the related tutorials listed above. If someone wants to see something specific, let me know and I'll post it.
Can anyone help me figure out what steps I need to take to create this app? If I can get my xml data to appear in the scroll view (each item on its own page) and have the number of pages determined dynamically, I'd be pretty set and can adjust it to include images and worry about making it "clickable" later.

Just stumbled on this awesome tutorial! Don't hunt for his source code and use that as it doesn't work properly. I had to tweak it a little bit to work in iOS 5, but it works. Converting it to iPad was as simple as changing the measurements. If anyone has questions about how I made this work, let me know. video posted here

Related

Want to achieve this kind of functionality in iphone app

I am having an app in which I want my view to be loaded like shown in the screen shot below.
The following view contains page control to show multiple images,buttons,labels,resizable text view and resizable text field in a single cell of table view.
There will be number of rows in a table view and rows will be generated dynamically.
Is there any cocoa control or tool which can give me functionality like this?
I have searched on cocoa control and goggled it a lot but couldn't find any matches to achieve this.
I thought of taking different views with sub viewing it didn't get much idea of how to generate it dynamically.
Please help me if someone has achieved this kind of functionality in any of their projects.
Thanks in advance.
Hint :
Divide each items in cells for single section, that means, one section for one item.
for e.g.
User photo, User name, User location and Post time in one cell.
Image gallery in another cell with page control on it.
Favourite (liked) post, comment on post and price in individual cells.
what you've to do is, create and add each item in a cell. While you're giving the height of each cell using delegate, check for conditions for which you're assigning the height. For e.g. if you've likes for the post (favourite) then only give height for that cell otherwise pass 0 (zero). Do the same for everything or as per your requirement.
For comments, you've to calculate text height, and based on that, you'll need to set height for comment cell.
References:
Here's a nice tutorial for this (not exactly) stuff. Rebuilding Instagram Feed Table View. I also googled a lot and found this, https://www.cocoacontrols.com/controls/stxdynamictableview, you may also need https://www.cocoacontrols.com/controls/mhpagingscrollview for showing image gallery.
P.S. This is not a "lunch plate" of course you've to make it for your self. Get hands on the keyboard! :)
Good luck!

What type of view is the Twitter profile on iOS? UITableView?

Is the twitter profile view in iOS just ONE very dynamic table view? What's in the header and what's in the cells? I've just started developing for iOS and I'm trying to look at the big players and identify what they use and how they use it.
I've made a similar view, but it's a view comprised of carefully placed subviews, and I'm wondering if something like this would be a better route.
If it is a UITableView, how do they have such dynamic cells with different spacing between them etc? I know you can vary cell sizes, layouts, and insets, but to this degree, in one tableview?
Please don't jump me with downvotes for asking a non-technical question only twitter devs know for sure, I'm just really curious and don't know where else to ask. I'm only looking for a professional opinion.
It looks like it could be a very dynamic UITableView to me. Or at least, it could probably be recreated as a UITableView if it isn't already.
I'm looking at a twitter profile page now, and I would say there's probably 5 sections:
Header (everything from the profile picture to the "follow" button)
Recent Tweets (including the "view more" button)
Photos
"Special" items (Following, Followers, Favorites and Lists)
Who to Follow
The only component of this view that strikes me as particularly unique and special is the banner image that blurs and zooms when you pull down too far. I'm not quite sure how they pulled that off. It's possible that they track the offset of the scroll view, and if the offset is positive (i.e. it was pulled down), then zoom and blur the banner (and use the offset value as a scaling factor somehow).
All the other components could be probably be recreated by (carefully) designing custom UITableViewCells for each unique purpose (e.g. tweets, image carousel, other profiles), and then populating those cells with data from the tweet or profile.

When I transfer from my master view to my detail view after adding a new item, my detail view is empty

I'm making a sample app to learn iOS dev, and I have the app create default items to populate the tableview originally, and you can add further ones as well.
If I tap on the default ones (well, there's only one) and segue to the detail view it shows all the details (Name, Location and Date) as intended. But if I add a new one, it comes up with those fields being Empty.
I can't figure out why. I have seemingly all the view refreshing methods set, and it should be setting the detail view's data object which then feeds the labels.
Could anyone help? I'd supply further code if requested, I just don't know what to supply now as I'm not sure exactly where the problem is. It's a rather simple app, though.
Project available here: http://cl.ly/3N0o272M3y1K
Ok this took a bit longer than planned - but it is a good way to learn.
I have attached the project in a zip file.
The code is a bit different then what you posted, but if you compare them side by side, you will see how they are planned and build differently.
It shows the Segue working within the Storyboard.
There where 2 big problems with your project outside of your misuses of the methods.
You need something like Core Data if you want your data to be persistant. In the example I have given you I have used Plist, this will do the trick, but is not persistant in this case.
Also your detailViewController had no labels for the text to appear, so you will need to look into Custom Cells for that - to match your design.
Good Luck and I hope this is useful:-)
Updated Project

Objective C: How to implement a datagrid view (tables with multiple columns)

I am currently working on an iPad application that uses a table view to present data, I was inspired by the iTunes application in iPad that present it's data in multiple columns in a very nice and neat manner, and the most interesting thing is that during the portrait mode the itunes application displays data in 2 columns but when the user switches to landscape mode, it switches the display to 3 columns (since there are plenty of space to display data horizontally).
This is what i'm talking about:
but i found out that iOS SDK only supports single column for tableview (it would be nice to utilize the entire space provided on iPad screen to present data), i did some research and i found out that the best way to present data in multiple columns yet like spreadsheet style is to use datagridview instead, but iOS SDK did not provide any data grid view controls for iOS developers.
I found out over the internet some customized tables like:
AQGridView.
DTGridView.
and also the one from this:
http://usxue.is-programmer.com/posts/14176.html
and the one from this:
http://xebee.xebia.in/2011/04/14/building-editable-gridview-for-iphone-apps/
But sadly none of these ever met the requirements of the application i was working on.
Could you guys provide me some ideas or share some sample codes or links on how to display data in somehow-data grid view, to achieve similar effect used in iTunes application (as shown above).. Any form of help would be pretty much appreciated. Thank you guys!
The summary answer is, place multiple data "views" across in a single cell.
The more detailed answer:
Create custom views that represent the single cells you want. You can for this purpose make them resizable enough to work two across or three across (they will get loaded into 1/2 or 1/3 of the cells bounds).
Then make a custom UITableView cell, that can take two or three data items - load up an instance of the custom view previously created in the cell for each data item you have, placing them next to each other. You can have the cell do the view layout when groups of data items are added.
In the cellForRow code in the table delegate/datasource, you use your data source in groups of two or three (and report the row count accordingly) to pass along to the custom cell.
Sorry I can't share code, but I have used this technique before in other applications.
What's wrong with creating a UIView class to represent a single cell, and another that lays out an array of those cells in a grid? Put your grid view in a UIScrollView and you're about done.
UITableView is obviously a pretty complex class. Much of that is to make it very general, very reusable, and able to support a huge number of rows. Your class doesn't necessarily need to be that complicated -- if you have a fairly small number of cells, your "grid" could really just be a UIView in which you lay out cells in rows and columns. UITableView removes cells that aren't seen in order to save memory; you might need to do something similar if you have hundreds of cells, especially if they're large, but a few dozen probably won't require that.
In short, since you need a grid view for a particular use, you don't need to do all the extra work that would be required for a general, reusable solution.

Collapsable/Accordion like view in iOS

I am trying to develop a collapsable/accordion like feature in my iOS app. This would be your typical FAQ type feature that would be found on web sites. I would like to tap the heading and then the detail is displayed.
Since this is for the help section and there are only a few items I thought I would be super simple to embed an HTML file with some JS in it to perform the action and render it in a web view. I got that to work without an issue. It loads and works great. However, with the web view I can 'bounces'/pull down the view to reveal the background of the main view. Now, this would not be a problem normally but since the designers use some gradients it looks awful. I set bounces to false and all is well but not super smooth when scrolling.
Here is an example of the accordion I am talking about.
I then found this project.
Which is a little more on the right track. But the table view height stays fixed and does not act like the other accordion view.
My question is this....am I missing something? Should I be looking at a different design pattern? Any ideas are appreciated.
I never found the answer. I ended up creating a basic master - details table view instead.
I created an array with 4 dictionary objects. Each object has a title and an array of the items for the details.
My main table view is showing the 4 dictionary object titles and the detail view is showing the rest of the array elements. Seems fine. I was hoping to find a dynamically sizing table view but no such luck. Maybe for the next release.

Resources