Вы находитесь на странице: 1из 24

Session 102:

Beginning
iOS
Hello iOS
Hello iOS
UIKit

The BIG iOS framework!


Construct and manage user interface
Respond to user input
Drive main run loop and interact with
system
Many other common app features
UIKit

UIViewController
UIKit

UIView
UIKit

UIImageView
UIKit

UITextField
UIKit

UIButton
UIKit

UITapGestureRecognizer
Storyboards

Xcode’s graphical
interface builder
Add and arrange
UIViews
Auto Layout

Dynamically
decides the size
and position of
views using
Constraints
IBOutlet and IBAction

Interface Builder looks for these annotations in your code.


IBOutlet connects a view with your Swift code.
IBAction connects a user action with your Swift code.
Demo 1
Session 102:
Beginning
iOS
Collection Views
Collection Views
UICollectionView

What if you have a dataset of large or unknown size?


Reusable views - UICollectionViewCells
UICollectionViewDataSource

Protocol
Provides data to the Collection View

How many items


should I show?
Data Collectio
Source n View
What does each
one look like?
UICollectionViewDelegate

Protocol
Manage selection of collection view cells
Can modify response based on cell index

The user
Collectio
Delegate selected one of
n View
my cells.
Model-View-Controller

Model: Data, logic, rules


Controller: Accepts input, commands model and view
View: Visual representation

Owns
Owns
View Controller Model
User Interaction KVO
UINavigationController

Is itself a
UIViewController
Start by setting a root
view controller
Manages navigation
through screen
hierarchy
Demo 2
Session 102:
Beginning
iOS
Conclusion
What You Learned

Demo 1: Hello iOS


UIKit, Storyboards, Auto Layout
Demo 2: Collection Views
UICollectionView, Model-View-Controller,
UINavigationViewController
Lab: Loading data
plists, reloading collection views
Where To Go From Here?

iOS Apprentice
Free tutorials on our site
Twitter: @matt_luedke

Вам также может понравиться