menu
thoughtpower
Complete Stanford iOS class Assignm... Star this Commitment

thoughtpower commits to:
Completing Stanford Assignment 5 by 4/1/13. I should also post notes on lectures 11, 12, 13, and 14 here on stickk.
No more reports due
Details
My Commitment Journal
thoughtpower
thoughtpower
April 1, 2013, 9:15 AM
I completed Assignment 5 and downloaded it onto my iphone. Will show Sara tomorrow.
thoughtpower
thoughtpower
April 1, 2013, 9:14 AM
Lecture 12

- Persistence
- Archiving objects
- Rarely if ever use this
- File System
- Unix file system (starts at /)
- Can only write inside the app's sandbox
- application bundles directory (NOT writeable)
- documents directory
- caches directory
- NSSearchPathDirectory (other)
- NSFileManagerClass
- utility methods
- check to see if file exists, create/enumerate directories, move, copy, delete files
- is not used for reading and writing to files
- Aside: NSData's writeTOUrl to put images into cache
- NSString
- file appending strings, for example
- SQLLite
- SQL in a single file
thoughtpower
thoughtpower
April 1, 2013, 9:13 AM
Lecture 11

- Core Location
- framework for managing location and heading
- CLLocation
- properties
- coordinate, altitude, horizontal/vertical accuracy, timestamp, speed, course
- accurracy costs power
- speed
- negative value, means it's an invalid speed
- To set it up
- 1) Check to see what hardware is available
- Check if locationServicesEnabled has been allowed by user
-
- 2) Create a CLLocationManager instance and set up its delegate to receive updates
- 3) Configure manager according to which kind of location updating you wnat
- 4) Start the manager monitoring for location changes
- accuracy-based continual updates
- updates only when signficant changes occur
- region-based updates
- heading monitoring
- error reporting to the delegate
- signficant location changes monitoring
- works even if app is not running
- same for regionbased monitoring, can specify accuracy
- Mapkit
- MKMapView
- can have annotations on it
- coordinate, title, subtitle
- How to create it
- Drag it out from Xcode
- displays an array of annotation objects
- cannot set this directly, it's a read only attribute. Must call the addAnnotation(s) methods
- MKAnnotation objects
- MKAnnotationView associated with an MKAnnotation, in a very similar way to how table view cells are associated with cells
- mapView: viewForAnnotation similar to cellForRowAtAindexPath
- usually set canShowCallout = YES
- MKAnnotationView
- properties:
- annotation
- image // instead of the pin
- left/rightcalloutaccessoryviews
- enabled
- centerOffset
- draggable // Annotation must implement setCoordinate
- can set one of the callout accessory views to a UIControl
- mapView: annotation: calloutAccessoryControlTapped gets called
- can use didSelectAnnotationView to load up callout accessories
- in mapView: viewForAnnotation, set the UIImageView and set it to nil
- Then in didSelectAnnotationView, load the image
- be careful because by the time the image loads, the pin may not even be on screen, and the pins get reused
- Can set MKMapView settings
- mapType
- showUserLocation
- zoomEnabled
- scrollEnabled
- Overlays
- Instead of just displaying a simple annotation object, you can draw something on that region, drawRect
- Demo
- Building on demo from lecture 10
- Create a new UIViewController (drag onto screen) which will show the map
- Create UIViewController subclass, mapViewController
- Create the outlet as private outlet
- You will see an error by default, must include the mapkit framework
- define the model (in header file of controller)
- array of annotations
- overload the getters for mapView and annotations to keep the view and the model in sync
- Link up the TVC with the new mapViewController
- ctrl-drag from a table element to the new mapViewController in the storyboard
- name the segue
- in the TVC, define prepareForSegue
- set the annotations object on the new controller to be loaded
- cast segue.destinationViewController to be of type mapViewController *
- next we must get the annotations corresponding to a single photo
- create a new class, subclass of NSObject: FlickrPhotoAnnotatoin
- in the header file, declare that it implements MKAnnotation
- create a CLASS function called annotationForPhoto
- returns a FlickrPhotoAnnotation *
- It should alloc init the FlickrPhotoAnnotation object, set the photo and then return the new object
- also define a property "photo" so that people can get the photo back
- in the implementation
- implement the title, subtitle and coordinate functions
- In mapViewController, make it the delegate for the mapView
- then we can set the viewForAnnotation method
- set a leftCallOutAccessory to a UIImageView which we set to nil (assuming we want a left call out image
- then define the didSelectAnnotation method which sets the image
    This Commitment has no photos.
Displaying 1-1 of 1 result.
March 25 to April 1
Successful
Success
Success

saralin
saralin
- Referee approval report
Yep, showed me the app.
thoughtpower
thoughtpower
- Committed user success report
thoughtpower
thoughtpower
- Committed user success report
Recipient of Stakes
Anti-charity (Gun Control: NRA Foundation)
To change the Recipient of Stakes for your Complete Stanford iOS class Assignm... Commitment, enter their email address or stickK username below.
Total at stake: $500.00
Stakes per period: $500.00
Remaining Stakes: $0.00
Total Money Lost: $0.00
Referee
Supporters
This Commitment doesn't have any Supporters yet!
.
Your feedback has been sent. Thank you!