User Tools

Site Tools


android-labs-s16:ios_tutorial_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
android-labs-s16:ios_tutorial_2 [2016/02/01 15:30]
achin
android-labs-s16:ios_tutorial_2 [2016/02/05 15:32] (current)
xuan [CocoaPod]
Line 9: Line 9:
  
 First, a few miscellaneous tweaks. First, a few miscellaneous tweaks.
-===== Git ===== 
 In the first lecture of the crash course you should have made a basic interface for the sample Instagram app. Since following lectures will build upon this content it would be nice if your code perfectly matches the sample code. In the first lecture of the crash course you should have made a basic interface for the sample Instagram app. Since following lectures will build upon this content it would be nice if your code perfectly matches the sample code.
  
-The app has been checkpointed at a finished state after lecture 1 and uploaded to GitHub as a repository. You should clone this repository for lecture 2. If you have never used GitHub or even Git, read about it [[http://​www.sbf5.com/​~cduan/​technical/​git/​|here (conceptual overview)]] when you have spare time. [[http://​stackoverflow.com/​questions/​315911/​git-for-beginners-the-definitive-practical-guide|This guide details Git's usage from a practical standpoint.]]+=====Git===== 
 +If you have never used GitHub or even Git, read about it [[http://​www.sbf5.com/​~cduan/​technical/​git/​|here (conceptual overview)]] when you have spare time. [[http://​stackoverflow.com/​questions/​315911/​git-for-beginners-the-definitive-practical-guide|This guide details Git's usage from a practical standpoint.]]
  
 Essentially Git and other revision control/​source code management tools allow you tremendous power when working on individual projects or collaborating with others. It protects you from mistakes, allows multiple people to work on the same project safely, and gives developers the ability to track their progress. Essentially Git and other revision control/​source code management tools allow you tremendous power when working on individual projects or collaborating with others. It protects you from mistakes, allows multiple people to work on the same project safely, and gives developers the ability to track their progress.
 +
 +The first thing you should do is to start with registering an account of Github : https://​github.com
 +
 +After registration,​ start with creating an new repository, for public repository, its free, but anyone can see your code.
 +
 +{{:​android-labs-s16:​w2-1.png}}
 +
 +Now after you create your new repository, here’s a example **https** link to your git
 +
 +**https://​github.com/​xuaninbox/​CS407.git**
 +
 +So you have two ways to link your git with your project, with command line or with GUI interface.
 +
 +here’s how you can do it with GUI in Xcode
 +
 +{{:​android-labs-s16:​w2-2.png}}
 +
 +switch to the **remote** tab and **add a remote**
 +
 +{{:​android-labs-s16:​w2-3.png}}
 +
 +again in the **Source control**, **click commit**
 +
 +{{:​android-labs-s16:​w2-4.png}}
 +
 +a **Message** is required and when select **Push to remote**, it will also push it to the remote git. 
 +
 +//Now go back to ur git and see if ur code is there//
 +
 +=====CocoaPod=====
 +
 +CocoaPod is a easy way for u to manage the libraries of your project, now start with the tutorial to install cocoapod on https://​cocoapods.org
 +
 +after you finish the INSTALL section
 +
 +use command line to go to ur project folder
 +
 +and do **pod init**
 +
 +open the **Podfile** in the folder
 +
 +add the following text
 +
 +    target '​P2'​ do
 +    ​
 +    pod '​AFBlurSegue',​ '~> 1.2.1'
 +    ​
 +    end
 +
 +after **pod install** or **pod update** go to you project, from now on you **should use XXX.xcworkspace**
 +
 +OSX 10.11 BUG?
 +
 +http://​stackoverflow.com/​questions/​32810808/​can-not-perform-pod-install-under-el-capitan-15a279b
 +
 +{{:​android-labs-s16:​w2-5.png}}
 +
 +Awesome! You just installed you first 3rd party library: AFBlurSegue ​
 +
 +https://​github.com/​AlvaroFranco/​AFBlurSegue
 +
 +=====Segue=====
 +
 +In this section you will create the two basic segue, **Show** and **Present modally** ​
 +
 +Now use 3 View controller
 +
 +{{:​android-labs-s16:​w2-6.png}}
 +
 +The **two button (show & present modally)** will let you **either show or present modally** to the new controllers.
 +
 +Also by using
 +
 +    override func prepareForSegue(segue:​ UIStoryboardSegue,​ sender: AnyObject!) ​
 +    if (segue.identifier == "​XX"​) ​
 +
 +
 +You should make the label on the new controllers to print ‘SHOW’ or ‘MODAL’
 +
 +Now try run it in the simulator and see if it works!
 +
 +=====lifecycle=====
 +
 +
 +This should be a easy one! lets try to understand how the view controller works, try to do the following
 +
 +{{:​android-labs-s16:​w2-7.png}}
 +
 +Now try run it in the simulator and tell us what is the sequence of the print and why so.
 +
 +=====Delegate=====
 +
 +Delegate is one of the most important aspect of the iOS programming,​ lets start with a simple delegate, **UITextFieldDelegate**,​ this delegate is used to handle text **UITextField**.
 +
 +Lets say you have a UITextField on your ViewController and you want to be notified every time user start to type something in it.
 +
 +**first drag the UITextField onto any of the ViewControllers you have created**, and **set the component’s delegate as its ViewController**
 +
 +{{:​android-labs-s16:​w2-8.png}}
 +
 +**Add the delegate in your swift code and the function that handle the callback**
 +
 +{{:​android-labs-s16:​w2-9.png}}
 +
 +As you can see we have added **UITextFieldDelegate** and a function **textFieldDidBeginEditing**
 +
 +//Now try run it in the simulator and see what happened when you start typing into the textfield.//​
  
 ===Cloning Lecture 1 Project=== ===Cloning Lecture 1 Project===
Line 161: Line 268:
  
 DONE!! DONE!!
- 
- 
- 
android-labs-s16/ios_tutorial_2.1454362247.txt.gz · Last modified: 2016/02/01 15:30 by achin