iPhone: Is there a pre-made UISettingsView? - iphone

On startup, if the user hasn't done any setting of NSUserDefaults, I want my main view to do a flipside view that brings up the same stuff that shows up in the Settings app.
Is there an API for instantiating the same controller that Settings uses, or will I have to reimplement a table view and controller myself?

This website hosts the 'MySettings' API which is a nice toolkit that encapsulates various Settings features (switches, choices, etc) all in a declarative (plist-based) API.

You have to code the ui elements yourself if you wish to make the perferences available within your app. The utility template in xcode gives you a starting point by making a flipview available.

Check out Craig Hockenberry's Generic Table Views, which make it really easy to set up a Settings-like table view.

Related

Creating a List of Custom Views in Xcode

I'm currently working on developing a desktop application for MacOS for downloading batches of audio files from URLs at one time I've run into a question about UI design that I can't figure out.
I have a class called SongEntry.swift that holds information regarding the URL that was entered (e.g. url, title, length, author, etc.) and I want to create a vertically growing list of custom views that updates when a new one is added.
Where is what the base view looks like:
Inside of the big white area is where I want the list to be held.
I've tried to create a separate view controller that handles each entry but that didn't work. I know UI design for MacOS is much different from iOS, however I think what I'm looking for is a way to simulate the table views and cell prototypes from iOS but can't find a suitable option.
If anyone knows of a possible solution or can point me in the right direction, I'd greatly appreciate it!
What you want is one of the collection views. For vertical list, you'll probably use NSTableView with only one column and hide everything else like headers.
Here are roughly the steps you need:
You can use your existing view controller or create a dedicate view controller for just the table (and use the 'embed' option in Interface Builder)
This view controller will adopt the NSTableViewDataSource and NSTableViewDelegate protocols to provide the data (your SongEntry objects) and the view for each row.
You set your NSTableView's source and delegate to your view controller.
You create a view which will serve as your "cell", it will be used by each row to display the data. You can design it either in IB or in code.
The entire process is described in detail in the Table View Programming Guide for Mac.
This topic can be a bit confusing. Note that there are two main approaches: the view-based and NSCell-based tables. Don't bother with the NSCell way, it's more of a legacy leftovers.
Also note that there are some overlap of methods in both NSTableViewDataSource and NSTableViewDelegate to provide data and views that can be a bit confusing at first. Just play around with the code and samples and it will be clearer which delegate method to use when.
There are many examples both on Apple's developer site and github. Also a good tutorial on raywenderlich.com.

Three20-Popup a detail view controller and add new item to data source

I am new to three20 and iphone development. I want to achieve a real simple function. I have a TTTableViewController which binds to TTListDataSource. I also have an add(+) button on top right corner. When that add button is pressed, I want to pop up a detail view for the user to enter the information. Then after the user navigate away from the detailed view by saving, the TTListDataSource will be updated with user entered data.
I looked over the examples provided by Three20 library, and didn't find a good example for this. Can anyone provide some clue on how to achieve this functionality?
If you're new to the ios development, I suggest you start with some basic & coredata tutorials before jumping into the three20 framework. Three20 is mostly about UI elements and easier to manage controllers navigation.
I believe Three20 doesn't has any storage / database framework, so you will have to use the standard core data apple provide. Here's a good example project with a table view & add feature:
http://developer.apple.com/library/ios/#samplecode/CoreDataBooks/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008405
After you have good understanding of the core data framework, it will easier to implement using three20.

Create springboard like main view

Is there some sample code, or an easy way, to implement an application with as its first view something like Springboard?
What I am looking for is just a view with basic icons which after a tab on an icon tells the view-controller to push the view associated with the selected icon.
This in itself is not that difficult off-course (just putting images on a view), but is there an easy way to implement all the extra functionality as well (as e.g. moving the icons around (start 'vibrating' when when you push hold them), multiple pages etc.). The Facebook App seems to have this. It is probably not worth my while to write it myself, but it would be nice if there is something 'out of the box' to give the App a bit more of an iPhone feel.
Thanks in advance!
Facebook uses the Three20 library for its UI. The specific view used for the SpringBoard-like interface is known as TTLauncherView.
This is not an endorsement (I have yet to really check this out, and I may be too entrenched in using Three20 at this point to even bother), but here is another project that implements the springboard functionality: myLauncher on Github
You can use UICollectionView to create this
Look at this example
https://github.com/tularovbeslan/Springboard

Show annotation in custom views

First off - I'm not using MapKit. I'm using my own controls for something entirely different. But the annotation view is something I'd like to mimmic. I've seen other applications with similar views to indicate state or actions on other controls. However, scanning through the class library I can't find a view already in the SDK. Do I have to create my own custom view that mimics this look and behavior or does the iPhone provide a standard way of showing these annotations?
You have to create your own (or find an open source implementation). The annotation views are actually drawn by the map view so they don't work outside of a map.
Well I couldn't find an open source solution so I built my own. To save anyone else the trouble, the source can be found at
http://github.com/appsinyourpants/Pants-Framework/tree/master/Classes/Views/

Iphone sdk - How to setup a 'template'

I've been working on a Cook Book App and I've been making each page individually which takes a really long time to do, I asked a question similar to this and it was brought to my attention that you can setup a way to automate the design process so all you need to do is input your data.
Can someone please explain in as much detail as possible how you setup your xcode files/code to automate such a process
So for example I would just enter the page text and it would automatically put my standard background picture in and add a scroll view and appropriate buttons etc.
Thanks
You could make one master view that contains all the controls that you need: standard background picture, scroll view, appropriate buttons, etc, and make any subsequent views that you create inherit from this view, so that they all contain those controls.
You could also use just one view and work with multiple instances of it, one instance per page. Just make sure to have a Text property on it, or a constructor that takes in your text string, so that you could set it to a different text on each page.
Xcode project templates and file templates are pretty easy to make, with a few caveats.
Check the answers to these questions:
Add new templates in Xcode
Change templates in XCode
Also take a gander at these handy tutorials:
Custom Xcode Templates
Xcode: How to customize the existing project templates
It sounds to me like your putting your data into your views (pages). That's a big design error. You need to employ the Model-View-Controller design pattern and separate your data from your views. That will make it easy to create one view (template) that you can reload with data to display each individual recipe.
The first thing to do is to separate your data from the view. You need to have the recipes stored in an array, dictionary, Core Data etc and then wrap that data in a dedicated object. The second thing to do is to create a dedicated view to display all the recipes. As the user moves from recipe to recipe the app will simply remove and add information to the same view as needed.
I would recommend Cocoa Recipes for Mac OS X: The Vermont Recipes, Second Edition because it addresses these issues and it uses a recipe type app as its example. It's for Cocoa but the basic principles apply to iPhone apps as well.