Skip to content

Commit 3d2574e

Browse files
author
David Benko
committed
Fixed Bug on iOS7 that caused FATAL runtime crash
1 parent 52e3c47 commit 3d2574e

File tree

6 files changed

+55
-3
lines changed

6 files changed

+55
-3
lines changed

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
TutorialView
22
============
33

4-
A UIView subclass that will draw arrows and instructions to the screen using Core Graphics, Core Text, and Core Animation.
4+
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.
5+
6+
The project consists of two classes: the TutorialView and the Arrow.
7+
8+
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.
9+
10+
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.
11+
12+
This project has been tested on iOS6.X and iOS7 as well as Android 4.X.X.
13+
Feel free to fork me to add updates and bug fixes!
14+
515

616

717

iOS/.DS_Store

0 Bytes
Binary file not shown.

iOS/Arrow.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ - (void)setCurved:(BOOL)shouldCurve {
6565
}
6666
- (void)generatePath {
6767

68-
CGMutablePathRef arrowPath = CGPathCreateMutable();
68+
//Early out if invalid path
69+
if(CGPointEqualToPoint(head,tail))return;
6970

71+
CGMutablePathRef arrowPath = CGPathCreateMutable();
72+
7073
BOOL shouldCurve = (self.head.x == self.tail.x || self.head.y == self.tail.y) ? NO : self.curved;
7174

7275
CGPathMoveToPoint(arrowPath, nil, self.head.x, self.head.y);
@@ -92,7 +95,7 @@ - (void)generatePath {
9295
// Compute P and Q:
9396
CGPoint P = CGPointMake(B.x - CB.x - CB.y, B.y - CB.y + CB.x);
9497
CGPoint Q = CGPointMake(B.x - CB.x + CB.y, B.y - CB.y - CB.x);
95-
98+
9699
CGPathMoveToPoint(arrowPath, nil, self.head.x, self.head.y);
97100
CGPathAddLineToPoint(arrowPath, nil, P.x, P.y);
98101

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDESourceControlProjectIdentifier</key>
6+
<string>FD8CC262-2AC0-4DC5-990B-04FCDE4FA1C2</string>
7+
<key>IDESourceControlProjectName</key>
8+
<string>TutorialViewSample</string>
9+
<key>IDESourceControlProjectOriginsDictionary</key>
10+
<dict>
11+
<key>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</key>
12+
<string>ssh://github.com/DavidBenko-PRNDL/TutorialView.git</string>
13+
</dict>
14+
<key>IDESourceControlProjectPath</key>
15+
<string>iOS/TutorialViewSample/TutorialViewSample.xcodeproj/project.xcworkspace</string>
16+
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
17+
<dict>
18+
<key>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</key>
19+
<string>../../../..</string>
20+
</dict>
21+
<key>IDESourceControlProjectURL</key>
22+
<string>ssh://github.com/DavidBenko-PRNDL/TutorialView.git</string>
23+
<key>IDESourceControlProjectVersion</key>
24+
<integer>110</integer>
25+
<key>IDESourceControlProjectWCCIdentifier</key>
26+
<string>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</string>
27+
<key>IDESourceControlProjectWCConfigurations</key>
28+
<array>
29+
<dict>
30+
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
31+
<string>public.vcs.git</string>
32+
<key>IDESourceControlWCCIdentifierKey</key>
33+
<string>AB2CFBD4-3E89-4153-B442-4714D6A8C15F</string>
34+
<key>IDESourceControlWCCName</key>
35+
<string>TutorialView</string>
36+
</dict>
37+
</array>
38+
</dict>
39+
</plist>

0 commit comments

Comments
 (0)