cs193p – Lecture #18 – Localization, Adding UI to Settings

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #18 – the final lecture of fall 2013/14 – covers localizations (internationalizations) and settings with demos for both …

cs193p - Lecture 18 - Localization - Settings
cs193p – Lecture 18 – Localization – Settings

The code for this lecture is available at github for Photomania and for Bouncer as well as from Stanford

The lecture as well as its slides are available via iTunes called “18. Localization, Adding UI to Settings”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #17 – Camera, Core Motion, Application Lifecycle

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #17 starts continuing the demo from the previous lecture (cleaning up code and location error handling).

A short introduction about how to use camera and the image-picker controller is followed by a short demo adding camera functionality to Photomania.

Core Motion theory is followed by another demo … including application states …

The code for this lecture is available at github for Photomania and for Bouncer as well as from Stanford

The lecture as well as its slides are available via iTunes called “17. Camera, Core Motion, Application Lifecycle”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #16 – Modal Segues, Text Fields, Alerts, and Action Sheets

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #16 starts with modal view controllers (taking over the entire screen on the iPhone by covering it, on the iPad as pop overs) including unwind segues (providing data back to the presenting view controller).

… some information about text fields and keyboard control, alerts and action sheets …

The demo adds a modal view controller and some text fields to Photomania and shows the described concepts …

Lecture #16 - Modal Segues, Text Fields, Alerts, and Action Sheets
Lecture #16 – Modal Segues, Text Fields, Alerts, and Action Sheets

The code for this lecture is available at gitub as well as from Stanford

The lecture as well as its slides are available via iTunes called “16. Modal Segues, Text Fields, Alerts, and Action Sheets”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #15 – MapKit and Embed Segue

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #15 introduces in detail the concept of MapKit and embed segues to use views from a view controllers as sub view as view of another view controller. … shown in an extensive demo …

Lecture #15 – MapKit and Embed Segue
Lecture #15 – MapKit and Embed Segue

The code for this lecture is available at gitub as well as from Stanford

The lecture as well as its slides are available via iTunes called “15. MapKit and Embed Segue”.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Extra Tasks #5 and #6

Please note, this blog entry is from a previous course. You might want to check out the current one.

Assignment #6 Extra Task #5

Adding the fetch for place and region information is going to break the way background fetching updates the app-switcher. Can you figure out why? Fix this problem. Hint: It is the background fetch completion handler that tells iOS to update the UI in the app-switcher. You can simulate a background fetch while running in the Simulator using the “Simulate Background Fetch” menu item in Xcode’s Debug menu.

… seems we took care of this problem … it’s working

Assignment #6 Extra Task #6

Switching to UIManagedDocument for our NSManagedObjectContext is going to break launching due to a background fetch event. Can you figure out why that is? Fix it. Remember that you can launch your application as if it were happening due to a background fetch by choosing Edit Scheme from the popup in the upper left corner of Xcode (near the run and stop buttons), then turning on “Launch due to a background fetch event” in the Options tab of the window that appears. You can also create a new scheme there that has that switch always on for easy background fetch launching during debugging.

… it’s also working …

What did we do wrong, that it works? We took care encapsulating Core Data requests (e.g. performing blocks in the managed-object context). We made sure that there is a single managed doucment which – while it is opening or getting created – is only accessed by a single process …

The complete code for all extra tasks is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Extra Task #4

Please note, this blog entry is from a previous course. You might want to check out the current one.

Teach yourself how to use NSFileManager and use it along with NSData’s writeToURL:atomically: method to cache image data from Flickr (the photos themselves) into files in your application’s sandbox (you’ll probably want to use the NSCachesDirectory to store them). Maybe you keep the last 20 photos the user looks at or all the photos in Recents or maybe 50MB’s worth of photos? Up to you.

Create a new class with two public class methods. One will cache provided data for a given URL. The other one will return the cached image, if possible.

+ (void)cacheImageData:(NSData *)data forURL:(NSURL *)url;
+ (UIImage *)cachedImageForURL:(NSURL *)url;

Continue reading “cs193p – Assignment #6 Extra Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #6 Extra Task #3

Please note, this blog entry is from a previous course. You might want to check out the current one.

If you were to use your application for weeks, your database would start to get huge! Implement a mechanism for pruning your database over time. For example, you might want to delete photos a week after you download them?

Add an additional date attribute created to the Photo entity to store when a photo has been added to the database. (Don’t forget to recreate its sub class).

Set the new attribute when a photo is added:

+ (Photo *)photoWithFlickrInfo:(NSDictionary *)photoDictionary
        inManagedObjectContext:(NSManagedObjectContext *)context
         existingPhotographers:(NSMutableArray *)photographers
               existingRegions:(NSMutableArray *)regions
{
    ...    
    photo.created = [NSDate date];
    ...
}

Continue reading “cs193p – Assignment #6 Extra Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail