Slide 1

Slide 1 text

These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 223 Enhancing User Experience with Scroll Views Josh Shaffer iOS Frameworks

Slide 2

Slide 2 text

Enhancing User Experience with Scroll Views

Slide 3

Slide 3 text

Enhancing User Experience with Scroll Views •UIScrollView configuration

Slide 4

Slide 4 text

Enhancing User Experience with Scroll Views •UIScrollView configuration •Improving paged scrolling

Slide 5

Slide 5 text

Enhancing User Experience with Scroll Views •UIScrollView configuration •Improving paged scrolling •Integrating with OpenGL

Slide 6

Slide 6 text

Enhancing User Experience with Scroll Views •UIScrollView configuration •Improving paged scrolling •Integrating with OpenGL •Controlling stop offset

Slide 7

Slide 7 text

Review of the basics UIScrollView Configuration

Slide 8

Slide 8 text

Content Size

Slide 9

Slide 9 text

contentSize.height contentSize.width Content Size

Slide 10

Slide 10 text

320 Content Offset

Slide 11

Slide 11 text

Content Offset 320

Slide 12

Slide 12 text

Content Offset 320

Slide 13

Slide 13 text

Content Offset

Slide 14

Slide 14 text

View for Zooming in Scroll View

Slide 15

Slide 15 text

View for Zooming in Scroll View

Slide 16

Slide 16 text

Paged Scrolling

Slide 17

Slide 17 text

Paged Scrolling

Slide 18

Slide 18 text

View Configuration

Slide 19

Slide 19 text

View Configuration

Slide 20

Slide 20 text

View Configuration Paging UIScrollView

Slide 21

Slide 21 text

View Configuration Paging UIScrollView Zooming UIScrollViews

Slide 22

Slide 22 text

View Configuration Paging UIScrollView Zooming UIScrollViews UIImageViews

Slide 23

Slide 23 text

View Configuration Paging UIScrollView Zooming UIScrollViews UIImageViews UIPageViewController

Slide 24

Slide 24 text

View Configuration UIPageViewController Zooming UIScrollViews UIImageViews

Slide 25

Slide 25 text

Page Spacing

Slide 26

Slide 26 text

Page Spacing

Slide 27

Slide 27 text

Page Spacing UIPageViewControllerOptionInterPageSpacingKey

Slide 28

Slide 28 text

Page Spacing

Slide 29

Slide 29 text

Page Spacing

Slide 30

Slide 30 text

Paged Scrolling

Slide 31

Slide 31 text

Paged Scrolling

Slide 32

Slide 32 text

Paged Scrolling After view controller

Slide 33

Slide 33 text

Paged Scrolling

Slide 34

Slide 34 text

Paged Scrolling

Slide 35

Slide 35 text

Paged Scrolling Before view controller

Slide 36

Slide 36 text

Paged Scrolling

Slide 37

Slide 37 text

Zooming

Slide 38

Slide 38 text

Zooming

Slide 39

Slide 39 text

Paged Scrolling

Slide 40

Slide 40 text

Paged Scrolling

Slide 41

Slide 41 text

Demo Eliza Block

Slide 42

Slide 42 text

Integrating UIScrollView and OpenGL

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

UIScrollView

Slide 54

Slide 54 text

Demo Eliza Block

Slide 55

Slide 55 text

Common surprises Run Loop Modes

Slide 56

Slide 56 text

Common surprises Run Loop Modes [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO];

Slide 57

Slide 57 text

Common surprises Run Loop Modes [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO]; NSTimer *timer = [NSTimer timerWithInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO];

Slide 58

Slide 58 text

Common surprises Run Loop Modes [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO]; NSTimer *timer = [NSTimer timerWithInterval:1.0 target:self selector:@selector(handleTimer:) userInfo:nil repeats:NO]; [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSCommonRunLoopModes];

Slide 59

Slide 59 text

Common surprises Run Loop Modes

Slide 60

Slide 60 text

Common surprises Run Loop Modes [self performSelector:@selector(performDelayedWork) withObject:nil afterDelay:1.0];

Slide 61

Slide 61 text

Common surprises Run Loop Modes [self performSelector:@selector(performDelayedWork) withObject:nil afterDelay:1.0]; [self performSelector:@selector(performDelayedWork) withObject:nil afterDelay:1.0 inModes:@[NSCommonRunLoopModes]];

Slide 62

Slide 62 text

UIResponder and Event Delivery

Slide 63

Slide 63 text

UIResponder and Event Delivery Parent View

Slide 64

Slide 64 text

UIResponder and Event Delivery Parent View Child View

Slide 65

Slide 65 text

UIResponder and Event Delivery Parent View Child View

Slide 66

Slide 66 text

UIResponder and Event Delivery Parent View Child View Child View

Slide 67

Slide 67 text

Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 68

Slide 68 text

Parent View’s View Controller Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 69

Slide 69 text

Window Parent View’s View Controller Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 70

Slide 70 text

Application Window Parent View’s View Controller Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 71

Slide 71 text

Application Delegate Application Window Parent View’s View Controller Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 72

Slide 72 text

Application Delegate Application Window Parent View’s View Controller Parent View UIResponder and Event Delivery Parent View Child View Child View

Slide 73

Slide 73 text

UIResponder and Event Delivery OpenGL View Scroll View

Slide 74

Slide 74 text

UIResponder and Event Delivery OpenGL View Scroll View

Slide 75

Slide 75 text

UIResponder and Event Delivery OpenGL View Scroll View Scroll View

Slide 76

Slide 76 text

Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Scroll View Scroll View

Slide 77

Slide 77 text

Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Scroll View Scroll View

Slide 78

Slide 78 text

How not to do it UIResponder and Event Delivery

Slide 79

Slide 79 text

How not to do it UIResponder and Event Delivery - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesBegan:touches withEvent:event]; }

Slide 80

Slide 80 text

How not to do it UIResponder and Event Delivery - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesBegan:touches withEvent:event]; }

Slide 81

Slide 81 text

How not to do it UIResponder and Event Delivery - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesBegan:touches withEvent:event]; } Application Delegate Application Window OpenGL View’s View Controller OpenGL View Scroll View

Slide 82

Slide 82 text

Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Scroll View Scroll View

Slide 83

Slide 83 text

Application Delegate Application Window OpenGL View’s View Controller OpenGL View OpenGL View Scroll View Scroll View UIResponder and Event Delivery

Slide 84

Slide 84 text

Scroll View OpenGL View Application Delegate Application Window OpenGL View’s View Controller OpenGL View Scroll View UIResponder and Event Delivery

Slide 85

Slide 85 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View Scroll View UIResponder and Event Delivery OpenGL View

Slide 86

Slide 86 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View Scroll View UIResponder and Event Delivery OpenGL View

Slide 87

Slide 87 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View

Slide 88

Slide 88 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View

Slide 89

Slide 89 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Child View Child View

Slide 90

Slide 90 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Child View Child View

Slide 91

Slide 91 text

Scroll View Application Delegate Application Window OpenGL View’s View Controller OpenGL View UIResponder and Event Delivery OpenGL View Child View Child View

Slide 92

Slide 92 text

Demo Eliza Block

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

No content

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 text

No content

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

Deceleration Targets

Slide 99

Slide 99 text

Deceleration Targets - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

Slide 100

Slide 100 text

Deceleration Targets - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { *targetContentOffset = ClosestCarOffset(*targetContentOffset); }

Slide 101

Slide 101 text

Demo Eliza Block

Slide 102

Slide 102 text

Jake Behrens UI Frameworks Evangelist [email protected] Documentation Scroll View Programming Guide for iOS http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg Apple Developer Forums http://devforums.apple.com More Information

Slide 103

Slide 103 text

Introducing Collection Views Marina Thursday 9:00AM Related Sessions Building Advanced Gesture Recognizers Marina Thursday 11:30AM

Slide 104

Slide 104 text

Scroll Views on iOS Lab Essentials Lab A Thursday 9:00AM Labs

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

No content