Questions about recreating the "Add Alarm" form in the iOS Clock app - iphone

(source: kominetz.com)
Hello. I'm diving into iOS development and am building my own alarm app to become familiar with the SDK. My questions are...
I've played around with UITableViews a bit, but I don't understand how I would implement the table at the top half of this form. If I had to guess, I would say it's a single UITableView, defined with one section and four rows, is that right?
If so, to implement it, would I just "hardcode" the cellForRowAtIndexPath function to create each cell manually?
If not, is there an adopted approach to defining the layout and functionality of these types of settings pages?
Row #3 has a switch in it, is this a predefined cell style or a custom cell style that I have to define myself?
Rows #1, 2, and 4 take the user to new views when they're touched. Is this a predefined style and or do I just implement the standard didSelectRowAtIndexPath functionality to push a new view onto the stack?
Thanks so much in advance for your help! I'm going to continue researching these questions right now.

In answer to your questions:
Yes
Yes
n/a
No, you have to add a UISwitch to the cell's contentView. Tip: Look at Apple's UICatalog sample code (controls sections) to see how to implement a tableview with different controls in different rows.
Just use didSelectRow...

For most apps, you want to implement the Application Preferences settings plist that will be used by the device's Settings application. It's typically a good idea to keep the settings for your app consistent with how the settings work in other apps.

Related

implement periodic table like grid layout in iphone app?

i am just developing some simple app which show the periodic table but my problem is how can i achieve the periodic table like layout in my iPhone app in just landscape format.
i have tried to search some CustomGridLayout sdk for IOS but not suitable for me
have goggled the things but not succeeded
following is the reference of periodic table layout which i want to implement
There is a couple way to do this:
1) You may use UICollectionView with custom cell. for this.With cell size equal element cell. But you will hit a several problem here: Some cells should be disabled, and customized in non standard way. In this case section is not useful for you. Overlay button in top on collection view may be difficult to positioning in storyboard.
2) You can use UIContainerView with totally custom view and colors. Dynamically added to custom row and column. This ofc have some flaws. Harder to build layout in storyboard (compared to (1) solution), memory management issues.

How can I make a grid similar to iphone/ipads launcher screen?

I have seen a few grids made with UITableView but I don't really like how close together each cell is to the other. If there is a way of creating a grid system like the home screen on an iphone (the screen after it is unlocked) if would be great. I don't need an exact solution but a point in the right direction, maybe a set of libraries to look through would be great. I am running xcode 4.4.1
Thanks!
The key is UIScrollView has a paging mode (since could have more buttons than fit in the view). It's covered here's in Apple ocs:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/ScrollViewPagingMode/ScrollViewPagingMode.html
If you use that, each 'page' would have n buttons/views that when clicked would call a protocol/delegate call back for the consumer with the data to handle and it would evenly layout the UIView/buttons across that page view. Contact me if you want my sample.
You probably don't want to require iOS6 as a minimum requirement but if you do, you can do as H2CO3 suggested in the comment and us UICollectionview. Here's a tutorial: http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
There's also some open source launchers that you can look into their code. Here's some (I'm sure there's more).
http://www.cocoacontrols.com/platforms/ios/controls/sespringboard
Code is at: https://github.com/sarperdag/SESpringBoard
Also: http://www.cocoacontrols.com/platforms/ios/controls/openspringboard
Use UICollectionView. You can create grid type views using that. It is available in iOS 6.
If you can target iOS 6+, use UICollectionView. It's one of the best new things in iOS for years and it will be as important as UITableView.
The layout you're asking for is only a few lines of code.
NSHipster has a good explanation of UICollectionViews and Ray Wenderlich has a good tutorial.
(There's lots of example code out there, but here's a very simple example project I did recently for another question involving UICollectionViews)

UITableView-like NSTableView

I wondered how I can make a NSTableView to behave like a UITableView on iOS. For example, splitting the content into sections as well as the typical behaviour of the section headers.
Is that possible? If so, how?
Thank you very much.
Check NoodleStickyRowTableView:
http://www.noodlesoft.com/blog/2009/09/25/sticky-section-headers-in-nstableview/
It's part of NoodleKit:
https://github.com/MrNoodle/NoodleKit
One of the differences is that UITableView's "cells" are actually Views, while NSTableView's are proper cells. Views suck up more memory and there's a bit of work involved in getting NSTableView to accept views like cells, then a bit more to optimize it so that if you have a huge list it isn't too memory intesnive.
Luckily it's already (mostly) been done, and there's a github project:
1) https://github.com/Perspx/PXListView#readme (also check his blog for more info)
2) http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/
Good luck
I wasted several days on this - so you don't have to.
There is a Twitter UI framework TwUI which they went to a lot of trouble to get their desktop clients to look and behave like the iPhone. The Appkit is showing its age these days.
The con with this library is you can't add NSViews to their TWUIViews.
This maybe fine if you haven't spent a lot of time creating custom nsviews.
You can try this fork which I hacked to mimic the sticky header view.
It has group based tableviews like uitableview.
https://github.com/johndpope/osx-stickyheaders
It turns out Apple have a nice sample library here
https://developer.apple.com/library/mac/samplecode/TableViewPlayground/Introduction/Intro.html
And a simplified version here which demonstrates the FloatsGroupRows property with this line
[self.tableView setFloatsGroupRows:YES]
which for all intents and purposes makes the nstableview / sections look like a uitableview.
https://github.com/TomLiu/PlayTableView
The con with that is - it's not available for cell based table views.
It is only available on View Based tableviews.
Since Microsoft have recently reversed engineered UIKit including the UITableView - in c++, it may one day someone be so kind to port this back to OSX. An exercise for the reader.
https://github.com/Microsoft/WinObjC/blob/master/Frameworks/UIKit/UITableView.mm

iPhone - Proper UI controls for calculations

I am pretty new to iPhone development and currently working on an application which includes a view that performs a simple numerical calculation. In particular, the user enters 3 or 4 values into text fields and the view displays the result. Something along the lines of http://www.moneychimp.com/calculator/compound_interest_calculator.htm
What is the nicest way to achieve this? I am currently using simple UITextFields and a UILabel for the result but it doesn't look nice or "native-like". What UI object would be best to use?
Thank you!
It's entirely up to you. You're using the right classes for actual input- it comes down to how you choose to style those classes. I'd suggest looking at the documentation for UIView and CALayer (youView.layer, and include QuartzCore framework in your project).
A good start might be to choose a color scheme, a background for your app, and the look and feel you're shooting for- this will inform your styling. Try looking for apps that you think are elegant and attractive, and boil down what they do and what you like about them.
I'd say;
use a grouped table style (with the white tables with round corners on a blueish striped background)
embed settings values directly in the cell (aligned to the right) as much as possible
you can show a relevant keyboard (text, numbers) or picker view to let the user pick values, directly when they tap the cell. Use sliders and switches where relevant.
You may want to take a look at http://www.inappsettingskit.com/, we are currently investigating it for the same purpose and it seems to do the job
You can use either a UISlider or a UIPickerView if some of your values have limits.
You can use UISwitch for toggles.
You can also switch the default keyboard for your textfields to be numeric.
Other than that you seem to be on the right track.
Also, sometimes putting a view inside a scrollview makes things seem cooler even if its only one page. The auto bounce on scrollviews is kind of cool.

Multiple choics iPhone App - UITableView?

I am developing a voting app, where the User will be presented with a question and multiple choices. In a typical HTML world the choice for this interface would be a Radio Box/Check box. What kind of view would I use in the iPhone SDK for a similar behavior?
Are there any sample apps which I can refer to?
Thanks,
Amy
Any time you're displaying repeating rows of data, UITableView is the natural choice. UITableViewCell provides various properties for you to customize the selected state which you can use to show the user's selected choice.
If your question has a few answer (3-4), then you can use an UIActionSheet. This is much quicker to code and provides a good looking user interface, with the sheet animating from then bottom of the iPhone and presenting to your user multiple button related to the possible choices/answers. It's a radio interface, in the iPhone Style.
Another possibility is to exploit an UISegmented control, a different type of radio interface.
If there are many answers, an UITableView is your best choice.