COMP446_Fall_2012_Lecture_6

Download Report

Transcript COMP446_Fall_2012_Lecture_6

COMP 446 / ELEC 446
Mobile Device Applications
Scott Cutler
Professor in the Practice of Computer Technology
Department of Computer Science
Department of Electrical and Computer Engineering
[email protected]
9/26/12
Wednesday 2-3:30, DH 1046
Agenda
 Events of the Week
 Next week’s assignment and class
 Review of Assignment 3
 Some more on UIScrollView, UITableView
 Questions on Assignment #4
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
2
Events of the Week
 Apple sells over 5 million iPhone 5, supply constraints loom
 iPhone 5 Sales Break Record -- And Disappoint
 Apple's Maps app slammed over missing cities and other mistakes
 Apple apparently fixes iOS 6 Wi-Fi bug
 Apple supplier Foxconn: Production will resume tomorrow
 Verizon gets back on board with Windows Phone
 FCC to look at AT&T's FaceTime limits, says report
 Android Phone Hacked via NFC
 Behind the curtain at Google's Cirque du Soleil show
 Walmart Stops Selling Amazon Kindles
 Bad Timing: BlackBerry Outage Hits RIM on iPhone 5 Day
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
3
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
4
Current Roster
 Victor Acuna
 Ryan Artecona
 Gbenga Badipe
 Peter Chang
 Joan Chao
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
5
Current Roster (2)
 Alex Chiu
 Heaven Chen
 Lingo Dai
 Weibo He
 Sahil Hingorani
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
6
Current Roster (3)
 Abdul Nimeri
 Bill Robertson
 Frank Salinas
 Tyler Siegert
 Austin Witt
 Matthew Zhao
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
7
COMP 446 Syllabus

Lecture 1 - 8/22/12 - Introduction




Lecture 2 - 8/29/12- Assignment 1 issues and questions from videos






Watch before:
3, 4 (demo part)
Assignment:
#3 – Graphing Universal Calculator
Assignment due: Tuesday, 9/18 6:00 am (Monday 30:00)
Lecture 4 - 9/12/12 - Assignment 3 issues and questions from videos




Watch before:
1, 2
Assignment:
#2 – Function Calculator
Assignment due: Friday, 9/7 6:00 am (Thursday 30:00)
Lecture 3 - 9/05/12 - Assignment 2 issues and questions from videos


Watch before:
None
Assignment:
#1 - Calculator
Assignment due: Friday, 8/31 6:00 am (Thursday 30:00)
Watch before:
4 (post demo), 5, 6
Assignment:
Continue with #3 – Graphing Universal Calculator
Assignment due: Tuesday, 9/18 6:00 am (Monday 30:00)
Lecture 5 - 9/19/12 - Assignment 3 issues and questions from videos



Watch before:
Watch 7 before class, 8 after class
Assignment:
#4 – Flickr Top Places
Assignment due: Friday, 9/28 6:00 am (Thursday 30:00)
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
8
COMP 446 Syllabus

Lecture 6 - 9/26/12 - Assignment 4 issues and questions from videos




Lecture 7 - 10/03/12 - Assignment 5 issues and questions from videos




Watch before:
Assignment:
10 (after Tab Bar), 11, 12
1: #6 – Flickr Core Data
- Likely to be broken into required and optional parts
- Optional part required for A+
2: Final Project Topic (due before next class)
Assignment due: Friday, 10/12 6:00 am (Thursday 30:00)
Lecture 8 - 10/10/12 - Assignment 6 issues and SQL




Watch before:
8, 9 very beginning of 10
Assignment:
#5 – Flickr Map Places
Assignment due: Friday, 10/5 6:00 am (Thursday 30:00)
Watch before:
13, 14
Assignment:
Final Project Proposal
Assignment due: Tuesday, 10/16 6:00 am (Monday 30:00)
Lecture 9 - 10/17/12 - iOS 6



Watch before:
Optional 15, 16
Assignment:
iOS 6 app
Assignment due: Friday, 10/26 6:00 am (Thursday 30:00)
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
9
COMP 446 Syllabus

Lecture 10 - 10/24/12 – HTML 5




Lecture 11 - 10/31/12 - TBD





Assignment:
Continue working on Final Project
Assignment due: Wednesday, 11/28 2:00pm
Lecture 14 - 11/21/12 – No class, but continue on final project



Assignment:
Continue working on Final Project
Assignment due: Wednesday, 11/28 2:00pm
Lecture 13 - 11/14/12 - Individual meetings on Final Project


Assignment:
Continue working on Final Project
Assignment due: Wednesday, 11/28 2:00pm
Lecture 12 - 11/7/12- Android vs. iOS vs. Windows Phone group debate


Watch before:
Optional 17, 18
Assignment:
Major Final Project Feature
Assignment due: Friday, 11/2 6:00 am (Thursday 30:00)
Assignment:
Continue working on Final Project
Assignment due: Wednesday, 11/28 2:00pm
Lecture 15 - 11/28/12 - Final Presentations


Assignment:
Document Final Project
Assignment due: By time assigned for COMP 446 final (there is NO final exam)
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
10
Final Projects
 Projects will be individual
An acceptable iPad project can couple to an iPhone project
 Projects can be in iOS, Windows 8 or Android
 You are responsible for Win 8 or Android technology
 I have a small number of iOS devices that can be used by students
without one.



May have to share
Likely have to deploy from a non-community Mac
 Must utilize at least one major and one minor iOS framework and
feature not covered in first 6 assignments; preferably >1 major.
 Project must be pre-approved


Often because proposed project too difficult to complete
Sometimes need to be modified for content
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
11
Final Project Ideas
 Augmented Reality is always a winner
 There are some interesting robots utilizing the
iPhone.
 One could make a board game with iPhone players
and iPad game board.
 OpenGL is a good feature.
 External universal frameworks are NOT allowed.
 Utilizing a backend is good, but not much credit given
for backend logic
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
12
Final Project Request
 Rebecca Richards-Kortum Lab
 Cell-phone based micro endoscope for the detection
of cervical cancer
 Android based
 Project does not met COMP 446 Pedagogy


Can be external project if interested
Can be split into 2 parts with part 1 capable of being a
COMP 446 project
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
13
Final Project Timeline
9/19
9/26
10/03 10/10 10/17 10/24 10/31 11/7
11/14 11/21 11/28 12/5
- #4 9/28
- #5 10/05
- FP Topic 10/10
- #6 10/12
- FP Proposal 10/16
- Major Feature 11/2
- Individual Meetings 11/14
- Final Presentation 11/28
- Documentation due Finals Day
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
14
Week 7
 Watch CS193p lectures #10 (after Tab Bar), #11 and #12
 Make progress on CS193p Assignment #5

Try and complete before 10/03 class. Due Friday, 10/05 6:00 am .
 Submit assignments, review lectures at www.comp446.com
 Start thinking about big project
 Next week’s lecture – Maps, Blocks and Threads
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
15
What is coming up in the assignments?
 Assignment #4 – Flickr Top Places




Tab bar controllers
TableView controllers
ScrollViews
Data from the internet
 Assignment #5 – Fast Flickr Map



Builds on Assignment #4
Multi Threading / Grand Central Dispatch
MapKit
 Assignment #6 – Core Data Flickr


UIDocument
Core Data
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
16
Assignment #3b Comments
 No Retina support (iteration by pixel, not points)
 Many issues with graph title,
 Many toolbar issues with missing bar button items
 Confusion with rotation.
 Gesture issues with location, immediacy, sign, etc.
 But these were not the biggest problem
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
17
Sloppy Assignment Submissions
 Very incomplete testing.
 Missed direct, specific aspects of the assignment.
 Evidence of starting close to due date.
 Evidence of not studying the videos.

Videos are your friend. Demos even friendlier!
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
18
Final Project Timeline New
9/19
9/26
10/03 10/10 10/17 10/24 10/31 11/7
11/14 11/21 11/28 12/5
- #4 10/05
- #5 10/12
- FP Topic 10/10
- #6 10/17
- FP Proposal 10/16
- Major Feature 11/2
- Individual Meetings 11/14
- Final Presentation 11/28
- Documentation due Finals Day
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
19
Review of Vides 8-10
 Many of the slides to follow come directly
from the Fall 2011 Stanford CS193p slide
deck.
 Some come from earlier versions of CS193p
which I think were a bit clearer than the
current deck
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
20
New Classes
 UIImage and UIImageView
 UIWebView
 UIScrollView
 UITableView
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
21
UIImage
 Easy to create
 UIImage *image = [UIImage imageNamed”@foo.jpg”];


UIImage *image = [UIImage
imageWithContentsOfFile:(NSString *)path];


Path is a path to a file in your application sandbox
UIImage * image = [[UIImage alloc] initWithData:
(NSData *)data];


Looks in your Resources folder for file named foo.jpg.
Creates and image out of a collection of data.
Data in points, not pixels


SEC - 9/26/12
Shows up as same size on iPhone with or without retina
Does support high definition, retina images
COMP 446 / ELEC 446 - Week 6
22
UIImageView
 Subclass of UIView used to display UIImages
 Create in:
 Storyboard or
 UIImageView *imageView = [[UIImageView alloc]
initWithImage:(UIImage *)image];
 image is a property of UIImageView
 @property (retain) UIImage *image;
 Many other properties
 Highlighted images (i.e. to show selection or press)
 Animation (animates through an NSArray of images)
 Calls to start, stop and time animations.
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
23
UIWebView
 A complete internet browser inside a UIView
 Based on Apple started WebKit HTML rendering
 Will load HTML, PDF’s, mail and other complex
documents
 Supports light weight (time limited) JavaScript
 Can load from web URL or file URL
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
24
UIScrollView
 Handles images bigger than bounds of the
UIScrollView
 Built in gesture recognizers
 Super class of UITextView and UITableView
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
25
UIScrollView
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
26
UIScrollView
 Zooming based on affine transform of
underlining UIView
 scrollView.minimumZoomScale and
scrollView.maximumZoomScale must be set
 Required delegate method to specify view


-(UIView *)viewForZoomingInScrollView:(UIScrollView *)sender;
With one view, return sender.view
 Programmatically use:


-(void)setZoomScale: animated:
-(void)zoomToRect: animated:
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
27
UITableView
 The canonical class used for efficiently displaying
tables of data.
 Creates and reuses UITableViewCells
 Delegates
 UITableViewDataSource for data
 UITableViewDelegate for display information
 Both often part of UITableViewController
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
28
UITableView
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
29
UITableView
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
30
UITableViewDataSource
 -(NSInteger)numberOfSectionsInTableView:(UITableView *)sender;

Optional method, defaulting to 1
 -(NSInteger)tableView:(UITableView *)sender

numberOfRowsInSection:(NSInteger)section;
Required method
 - (UITableViewCell *)tableView:(UITableView *) sender
cellForRowAtIndexPath:(NSIndexPath *)indexPath;

NSIndexPath has two important properties, ip.section and ip.row.
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
31
UITableViewCell
 Standard methods or fully customizable.
 Built in properties



(readonly) UILabel *textLabel;
(readonly) UILabel *detailTextLabel;
(readonly) UIImageView *imageView;
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
32
UITableViewCell
 - initWithStyle:(UITableViewCellStyle) style
reuseIdentifier:(NSString *)reuseId;
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
33
UITableViewCell reuseIdentifier
 Creation of TableViewCells is expensive

The desire is for effortless scrolling through
hundreds or thousands of cells
 Only cells which are actively being displayed
need to be fully formed
 Cells which go off the edge or not destroyed,
but saved for reuse; keyed by reuseIdentifier
 DataSource methods for changing content of
established cells is very efficient
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
34
UITableViewCellAccessoryType
 The disclosure indicator
lets the user know that
more information can be seen if the cell is clicked.
 The Checkmark
signifies selection and is managed
by your program
 The DetailDisclosureButton
is a secondary
launcher that brings up different details than just
selecting the row.
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
35
UITableViewDelegate
 Second protocol, often implemented in the same
class as the UITableViewDataSource
 Most used method:


- (void) tableView:(UITableView *) sender
didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
Typically pushes another view controller related to cell
selected.
 Also has methods for:
 Controlling height
 Reacting to lifecycle events for the cell
 Custom header views and cell selection actions
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
36
Assignment 4 Tasks
 Read the list of 11 required tasks.
 Don’t forget to properly sort the lists
 Don’t forget to limit the number of recent photos to 20 and





that they are unique.
Properly show the requested cell title and subtitle
Show the table or navigation controller title
Initial view of a picture should be the largest that can
completely fit.
Scrolling, pinching, rotating and state saving need to work.
Suggest starting with a universal app as iPad optional this
assignment, but required for next.
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
37
Assignment #4 Questions
SEC - 9/26/12
COMP 446 / ELEC 446 - Week 6
38