cs193p – Project #3 Assignment #3 Task #2

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

Rename the ViewController class you’ve been working on in Assignments 1 and 2 to be CalculatorViewController.

Rename the filename, by selecting the filename and clicking one additional time:

cs193p - Project #3 Assignment #3 Task #2 - Rename Filename
cs193p – Project #3 Assignment #3 Task #2 – Rename Filename

Continue reading “cs193p – Project #3 Assignment #3 Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Project #3 Assignment #3 Task #1

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

You must begin this assignment with your Assignment 2 code, not with any in-class demo code that has been posted. Learning to create new MVCs and segues requires experiencing it, not copy/pasting it or editing an existing storyboard that already has segues in it.

… cross my heart …

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #9 Scroll View and Multithreading

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

The lecture starts with additional information on how to control the appearance of a view in different size classes and how to inspect constraints in various size classes.

Scroll Views

Adding sub views to a scroll view works similar like adding views to any other view. The only important difference is to define the content size of the scroll view:

scrollView.contentSize = CGSize(width: 3000, height: 2000)
logo.frame = CGRect(x: 2700, y: 50, width: 120, height: 180)
scrollView.addSubview(logo)
aerial.frame = CGRect(x: 150, y: 200, width: 2500, height: 1600)
scrollView.addSubview(aerial)

Continue reading “cs193p – Lecture #9 Scroll View and Multithreading”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #8 View Controller Lifecycle, Autolayout

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

View Controller Lifecycle

  • viewDidLoad is called after instantiation and outlet setting (geometry is not set yet!) – use for setup
  • viewWillAppear is called before the view appears on screen (geometry is available) – use for layout setup and updates which happened while the view was off screen
  • viewDidAppear
  • viewWillDisappear – use for cleaning up and saving states
  • viewDidDisappear

Continue reading “cs193p – Lecture #8 View Controller Lifecycle, Autolayout”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #7 Multiple MVCs

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

The seventh lecture addresses the interaction of multiple model-view controllers – especially navigation controllers.

Segues

The links between two view controllers are called segues. They always create a new instance of the called MVC and need to initialize that MVC e.g. using prepareForSegue.

Segues can also be prevented from happening using shouldPerformSegueWithIdentifier.

Popover

Where tab-bar, split-view and navigation controllers are view controllers, popovers are not. Though preparing popover segues works similar, their destruction needs special care, making the calling view controller the delegate.

The lecture and its slides are available via iTunes named “7. Multiple MVCs”. The code for the psychologist demo is available on GitHub and at Stanford.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Lecture #6 Protocols and Delegation, Gestures

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

The sixth lecture contains theory interspersed with demos of the just learned topics.

Extensions

Extensions allow to add methods and properties to classes even if the source is not available. It is not possible to override existing methods and properties. New properties can not be used to store data.

Protocols

Protocols define APIs of methods and properties a caller should provide. It has no storage or implementation associated.

protocol SomeProtocol : class, InheritedProtocol1, InheritedProtocol2 {
    var someProperty: Int { get set }
    func aMethod(arg1: Double, anotherArgument: String) -> SomeType 
    mutating func changeIt()
    init(arg: Type)
}

Continue reading “cs193p – Lecture #6 Protocols and Delegation, Gestures”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail