Wednesday, June 19, 2013

Chapter 6: Settings, Audio, and Shake Detection in TimeDown

Settings/Options - represent information, such as an account name, that users set ones and rarely change. Users view app-specific settings in the built-in Settings app. Configuration options are values that users might want to change frequently, such as category types displayed in a list; configuration options should be available within the app itself.

NSUserDefaults - provides convenience methods for accessing common types such as floats, doubles, integers, Booleans, and URLs. A default object must be a property list, an instance of NSData, NSString, NSDate, NSArray, NSDictionary.

AVFoundation framework - music
QuartzCore framework - UI design
AudioToolbox framework - vibration

Corrections
Add to TimeDownViewController.h:
    int timeSettings;

    BOOL autoStart;


deprecated method  -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration

Add CoreMotion framework, import in header, and add these methods

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
    if(event.type == UIEventSubtypeMotionShake)
    {
        //Add UIActionSheet code
    }
}

- (BOOL)canBecomeFirstResponder
{
    return YES;
}


Make sure your root.plist looks like the following:

iPhone Settings Schema
    Preference Items
        Item 0 (group - TimeDown)
            Title                String    TimeDown Settings
            Type                String    Group
        Item 1 (Text Field - Default Time (mins))
            Type                String    Text Field
            Title                 String    Default Time (mins)
            Identifier          String    timeSettings
            Default Value    String    5
            Keyboard Type  String    Number Pad
        Item 2 (Toggle Switch - Auto-Start)
            Default Value    Bool      YES
            Identifier          String    autoStart
            Title                 String    Auto-Start
            Type                String    Toggle Switch
        Strings Filename    String    Root

No comments:

Post a Comment