Create an XML file to save app data - ios

I am creating an app where there is a page which enables users to create a small project, I mean painting with the brush, adding labels, text fields, and adding UIImageViews and placing an image in them using the iOS library. then a screenshot is taken (for now) and it is uploaded on dropbox. from a tableview the users will be able to see all the uploaded documents. but the point is that it is only a screenshot. I wanted to upload things in a way that the textfields could be scrolled, and when I add the video feature, see the video. then add comments. I thought of uploading all the images, photos, textviews separately, and then save all the position of the pieces in an XML, so that the projects can be viewed from the table view: when a row is selected the app opens the XML and in base of that composes all the pieces like a puzzle. I decided to use Google library, (data), but I can't seem to find where to download the sample project with the library. so I put it at a side. I then tried to use NSXML parser, but I only see tutorials that enable asccess to an xml file, not actually create one according to each project!! Help!! How can I proceed? Any suggestions or tutorials? May be were to give me the link to data project, and please not to the google developer page or trunk, because it is a mess!!
thanks for the help in advance

There is a very good tutorial by Ray Wenderlich's web site (a great iOS dev and tutorial resource) on how to create XML with GDataXML here:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
Here is the GitHub repo: https://github.com/neonichu/GDataXML

OR you could use the very simple, very easy to use standard NSPropertyListSerialization:dataWithPropertyList:format:options:error and this is how you would do it:
Populate it with NSArray's and NSDictionary's (this is the part that requires the most code - but it isn't difficult to do). The objects in your dictionary are the children and sub children (which may be NSArray's of NSDictionaries). Then use the following to write it out:
NSData *xmlData = [NSPropertyListSerialization dataWithPropertyList: resultLists
format: NSPropertyListXMLFormat_v1_0
options: 0
error: &error];
//----- DO ERROR CHECKING (left out to simplify)
BOOL result = [xmlData writeToFile:arrayFileName atomically:YES];
Boom. An XML file.
I'm backing up a core data file and it is relatively trivial to do.
I normally like Ray Wenderlich's web site, but in this case he makes something that is very easy to do very complex. I've done it that way and honestly, the Apple way is much, much easier.

Related

Making UI elements programmatically in iOS using Xcode in Objective-C

I am trying to parse json data and convert it to form in iOS. I am successfully able to parse data and display it, however, i want to fix the UI and make it look more like an iOS form, perhaps using tableviews, etc.
How do I approach this? should I just use a tableviewController or use a tableview? (the fields are dynamically added, so I have no idea what type and how many fields I will have, until I make a call to the API and fetch the data from the json that I get)
Are there any easy to use libraries in iOS that I can use?
That's not how UI design works on iOS. For the specific example that you mentioned of a tableViewController getting fed from an API... You'll create a tableViewController and you will design a demo cell.
Then you will fetch the results from your API, parse it. And you will iterate over the results returned by the API, inside that iteration you will programatically create the table cells (thus ensuring that you are creating as many tables as you need).
Nevertheless this is a extremely vague question, and besides briefly explaining how this whole thing works on general terms, there is not much more I can do without you posting the code you have so far.
Allow me to refer you to this tutorial by NSCookBook that although old is gold when it comes to these things.
Regards,

List of available filters

I'm looking for the list of filters provided by Apple to apply on Images.
Summery : I want to create an application which will allow user to edit photos. I'm looking into Core Image Programming Guide, but not able to get full list of filters already available. Right now referring Core Image Filter Reference
Also I need to build this application with new language swift. And it would be my first swift app.So can we use this framework with Swift?
Any help is appreciated.
I've created a website called CIFilter.io which lists all the Core Image filters and their parameters (to learn more about how it works you can read this blog post). The documentation archive link you mentioned lists most of them, but as far as I know, CIFilter.io is the most up to date reference for documentation.
CIFilter is usable in Swift. I'd recommend reading this other blog post which provides example code for generating a color wheel using CIHueSaturationValueGradient for an example.

How to edit PDF Forms in iOS application?

i have a lots of PDFs forms and i want to put them on iPad and fill them up, then send it by mail. how can i edit this pdf forms in an app? i am very new with xCode and i could use lots of suggestions ...
How can I edit PDF files in an iOS application?
i found this question durring my search and the idea presented here,
"A better idea in my opinion is to create a native UI showing the data contained in the PDF file using the standard Cocoa-Touch UIKit, and create the PDF once the user is done with it so that the user can export it back. That way, you don't have to write a complicated PDF handling code." .. sounds very good just that i dont know how to start ...
Thanks
Basically, what it's saying is create a nib/screen/front end to the PDF that would allow the user to record what data they want in there, then after that run a separate piece of code to write that data into the PDF!
Some links to help you out:
Quartz-2D Programming Guide (QuartzCore Framework): https://developer.apple.com/library/ios/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html
A tutorial (Although aimed at iOS5)
http://www.raywenderlich.com/6581/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-1
I will say, I can find information on GENERATING PDF files a lot easier/more reliably than editing them... Are the templates you have difficult? It may be worth re-creating them programatically when the data is inputted!

Xcode RSS Images

I have an app that I am developing in Xcode which retrieves a RSS feed from my site and puts it into a table. Recently, I have created a new homepage with a featured article at the top, and I want to be able to have the image from the articles shown with it. Is there any way I can do this?
I am going to assume that in the RSS Feed there is a key called image or similar which its value will be an address pointing to the image.
After you load the article you should download each image asynchronously. For this I'd suggest you use NSOperation and NSOperationQueue.
There is a tutorial in Ray Wenderlich website which shows how to accomplish this.
You could use some kind of cache to avoid the images downloading each time.

Tagging in ios development

I'm an absolute newbie on iOS Development at the minute so please pardon me if this seems like such a simple question to ask.
I want to build a project - almost like a note taking application - in which the user will be able to associate tags to their inputs. I'm sure many have seen them before - it's used in things like hashtags, or to give an example of an iOS app - Journalling apps like DayOne have it. It's basically used to generate tags for easy retrieval of a particular article.
My question is - how do you go about creating these kinds of tags? Particularly - how do you implement the tagging system that can generate custom tags for articles in the app?
Is it something that is built into Cocoa/SDK or do i have to look at something more complex like Core Data (NSPredicates) to learn how to create something like that?
OR is it something that has to be done programatically rather than a built in system in SDK?
Thanks.
In a super simple form (i.e. there are many ways you can build on this to make it scalable):
If each note is text, create an object with properties for the text and the tags
Make the tags property an array of strings
Store the notes in an array initially (archive to save to disk, or just practice with a non-saved version)
Make the user enter the tags (auto-tagging is an interesting topic...)
Consider using a token field (google for 3rd party implementations) for tag entry
Now, when a user starts a search for tagged content, iterate through each of the notes you have and run a predicate on the tag array. This could be done using NSPredicate, or you could ensure that all tags are saved in lower case and, to start with, require exact matching - so you could use '[tagArray containsObject:userEnteredTag];`
Then:
Look at real predicates
Look at Core Data (or SQLite if you love it)
You will need to use Core Data or SQLite3. Personally I would use SQLite but it is down to preference. I have used both but if you have any SQL knowledge then I wouldn't use Core Data. Having created an app with CoreData and using a lot of NSPredicates I found that the app had a lot of bug that appeared over time.
I changed it to use SQLite and now it runs perfectly.
As you are new to iOS I would recommend you take a look at Ray Wenderlich's tutorials. I learnt a lot from there.
http://www.raywenderlich.com/913/sqlite-tutorial-for-ios-making-our-app

Resources