Skip to content

Commit

Permalink
Fixed Bug on iOS7 that caused FATAL runtime crash
Browse files Browse the repository at this point in the history
  • Loading branch information
David Benko committed Aug 6, 2013
1 parent 52e3c47 commit 3d2574e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
TutorialView
============

A UIView subclass that will draw arrows and instructions to the screen using Core Graphics, Core Text, and Core Animation.
TutorialView is a project which will draw animated arrows over your app to instruct the user on the functions of the application. It dynamically draws arrows to the screen based on a head and tail point for the arrow. It will automatically determine the direction and curve of the arrow and draw it to screen with animation. The view will disappear after it has been tapped by the user.

The project consists of two classes: the TutorialView and the Arrow.

The Arrow class is responsible for determining the size and shape of the arrow, its location on the screen, and whether it should be curved and/or animated.

The TutorialView class is the actual overlay responsible for drawing to the screen. On iOS, it uses Core Graphics and Core Animation to render the arrows and the ‘drawing’ animation. On Android, it uses the Path class and other android.graphics.* classes.

This project has been tested on iOS6.X and iOS7 as well as Android 4.X.X.
Feel free to fork me to add updates and bug fixes!




Expand Down
Binary file modified iOS/.DS_Store
Binary file not shown.
7 changes: 5 additions & 2 deletions iOS/Arrow.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ - (void)setCurved:(BOOL)shouldCurve {
}
- (void)generatePath {

CGMutablePathRef arrowPath = CGPathCreateMutable();
//Early out if invalid path
if(CGPointEqualToPoint(head,tail))return;

CGMutablePathRef arrowPath = CGPathCreateMutable();

BOOL shouldCurve = (self.head.x == self.tail.x || self.head.y == self.tail.y) ? NO : self.curved;

CGPathMoveToPoint(arrowPath, nil, self.head.x, self.head.y);
Expand All @@ -92,7 +95,7 @@ - (void)generatePath {
// Compute P and Q:
CGPoint P = CGPointMake(B.x - CB.x - CB.y, B.y - CB.y + CB.x);
CGPoint Q = CGPointMake(B.x - CB.x + CB.y, B.y - CB.y - CB.x);

CGPathMoveToPoint(arrowPath, nil, self.head.x, self.head.y);
CGPathAddLineToPoint(arrowPath, nil, P.x, P.y);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectIdentifier</key>
<string>FD8CC262-2AC0-4DC5-990B-04FCDE4FA1C2</string>
<key>IDESourceControlProjectName</key>
<string>TutorialViewSample</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</key>
<string>ssh://github.com/DavidBenko-PRNDL/TutorialView.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>iOS/TutorialViewSample/TutorialViewSample.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</key>
<string>../../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/DavidBenko-PRNDL/TutorialView.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</string>
<key>IDESourceControlWCCName</key>
<string>TutorialView</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.

0 comments on commit 3d2574e

Please sign in to comment.