Wednesday, June 19, 2013

Chapter 7: CoreData, iPod access, and playing music - PlayMyLists

Entity Name Warning - If entities duplicate existing class names within iOS frameworks, you may wind up with confusing errors at compile time


Corrections

- import AppPlayList.h in VCPlayListItems and create instance AppPlayList *playList;
- Change the VCPlayListItems class from an NSObject to a UITableViewController
- Be sure to add [[segue destinationViewController] setManagedObjectContext:self.managedObjectContext]; under -(void)prepareForSegue:(UIStoryboardSegue*)segue sender:(id)sender{ in PlayMyListsMasterViewController.m
- Make sure this is the first line under the configureCell method,     NSManagedObject *object = [[[(AppPlayList*)_detailItem tracks] allObjects] objectAtIndex:indexPath.row];
- Set MPMediaPickerControllerDelegate in VCPlayListItems
- In showMediaPicker, new iOS6 method [self presentViewController:picker animated:YES completion:nil];

I am unable to finish this because I have no music on the simulator app

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

Tuesday, June 18, 2013

Chapter 5: MapKit and the camera in WhereIsMyCar

The only changes are

[self presentViewController:picController animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];

[self presentViewController:vcDisplayPic animated:YES completion:nil];

Monday, June 17, 2013

Chapter 4: Accessing the Address Book/ Contacts in Dial4

I will begin creating the app project: Dial4 using a master-detail application model

When using the address book records from the array,

objc_unretainedPointer is called to the object pointer without transferring any ownership of memory
_bridge_transfer is used to typecast pointers to comparable Objective-C objects

Datasource is delegated control of data instead of the UI, responsible for managing the memory of the model objects



UINavigationController manage the presentation of hierarchical data

UIViewController provides the custom logic needed to bridge the app's data to the views, also known as the controller in the MVC concept
UITabBarController organizes app into one or more distinct modes of operation

A master-detail application defaults the first view controller to a table view controller. It also reinforces the concept that table views lend themselves to navigation controllers and vice versa


Apple Cell Styles

  • UITableViewCellStyleDefault - black, left-aligned, text label
  • UITableViewCellStyleValue1 - black, left-aligned, text label with smaller blue, right-aligned text label
  • UITableViewCellStyleValue2 - blue, right-aligned text label with smaller black, left-aligned text label
  • UITableViewCellStyleSubtitle - left-aligned label with smaller grey, left-aligned text label below

Apple Table view Cell Accessory Types
  • UITableViewCellAccessoryDisclosureIndicator - chevron
  • UITableViewCellAccessoryDisclosureButton - blue button with chevron
  • UITableViewCellAccessoryCheckmark - check mark

Apple Table View Cell Editing Styles

  • UITableViewCellEditingStyleNone - no control
  • UITableViewCellEditingStyleDelete - red circle with minus sign
  • UITableViewCellEditingStyleInsert - green circle with plus sign


Corrections



Instead of addressBook = ABAddressBookCreate();
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(nilnil);

Instead of NSData *d = (NSData)ABPersonCopyImageData([myContacts objectAtIndex:indexPath.row]);
NSData *d = (__bridge NSData*)ABPersonCopyImageData((__bridge ABRecordRef)([myContacts objectAtIndex:indexPath.row]));

- Add [av show]; after you create the alert
- Add break; after each switch case
- Add int prevSearchTextLen; to Dial4MasterViewController.h

Chapter 3:Using View Controllers and Images in PicDecor

I will now begin creating the app project: PicDecor

UIView provides a structure for drawing and handling events in a particular region, can contain multiple subviews
UIViewController provides view management functionality for toolbars, navigation bars, and app views, as well as modal views and rotating views when the device orientation changes

1) Determine product definition statement (PDS)
     Who is your audience? What is unique about the users of this particular app? What features should you provide?

Actions are methods that run when something in the UI is acted upon
Outlets are UI items the code needs to know about and change the attributes of


PicDecorViewController chooses the image, the ImagePickerDelegate saves the chosen image in a variable of VCImageEditing and shows this controller once the image is selected. When the decorate button is clicked in VCImageEditing, VCDecorations is shown. The user chooses a funny image to decorate with, this image is saved in a variable in VCDecorations, the controller is then dismissed to go back to VCImageEditing.

Sunday, June 16, 2013

Chapter 2: Creating an iOS Application

Interface(.h) - class declaration and defines instance variables & methods
Implementation(.m) - code for the methods

@interface HWAppDelegate : UIResponder <UIApplicationDelegate>
- the class inherits from the UIResponder
- the class implements the interface from the UIApplicationDelegate, which is a list of protocols

Delegation is similar to the action connection in that one object calls methods on another object as needed.

Chapter 1: Getting started with iOS development

XCode, Objective-C, and Apple frameworks are used along with the MVC pattern

Model - data
View - UI that the user interacts with
Controller - translates user interaction and accesses data

In this chapter we created a HelloWorld app by dragging a label to the view in storyboard.
Although iOS7 was just released, I want to go through a couple of my books to make sure I understand fundamental skills of objective-c.

I am starting with the book iOS in Practice by Bear Cahill I will make a blogpost for each chapter