Skip to content

Commit ccc2809

Browse files
committed
Add license (BSD) and readme
1 parent e1761ac commit ccc2809

4 files changed

Lines changed: 77 additions & 18 deletions

File tree

‎LICENSE‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2012, Denis Hennessy (Peer Assembly - http://peerassembly.com)
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of Peer Assembly, Denis Hennessy nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL PEER ASSEMBLY OR DENIS HENNESSY BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

‎PAPasscode.podspec‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
2-
s.name 'PAPasscode'
3-
s.version '0.1.0'
4-
s.summary 'A recreation of Apple's Passcode View Controller'
5-
s.homepage 'https://github.com/gowalla/AFNetworking'
6-
s.authors {'Denis Hennessy' => 'denis@hennessynet.com'}
7-
s.source :git => 'https://github.com/gowalla/AFNetworking.git',
8-
:tag => '0.1.0'
9-
10-
s.platforms 'iOS'
11-
s.sdk '>= 4.0'
12-
13-
s.source_files 'PAPasscode'
14-
end
2+
s.name = 'PAPasscode'
3+
s.version = '0.0.1'
4+
s.summary = 'A Passcode View Controller for iOS similar to the one in Settings.app'
5+
s.homepage = 'https://github.com/dhennessy/PAPasscode'
6+
s.authors = { 'Denis Hennessy' => 'denis@hennessynet.com' }
7+
s.source = { :git => 'https://github.com/dhennessy/PAPasscode.git' }
8+
s.platform = :ios
9+
s.requires_arc = true
10+
11+
s.source_files = 'PAPasscode'
12+
s.resources = 'Assets/*.png'
13+
s.framework = 'QuartzCore'
14+
end

‎PAPasscode/PAPasscodeViewController.m‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ - (id)initForAction:(PasscodeAction)action {
6262
break;
6363
}
6464
self.modalPresentationStyle = UIModalPresentationFormSheet;
65-
if (_simple) {
66-
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
67-
} else {
68-
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
69-
}
65+
_simple = YES;
7066
}
7167
return self;
7268
}
@@ -177,6 +173,12 @@ - (void)loadView {
177173
- (void)viewDidLoad {
178174
[super viewDidLoad];
179175

176+
if (_simple) {
177+
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
178+
} else {
179+
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
180+
}
181+
180182
if (_failedAttempts > 0) {
181183
[self showFailedAttempts];
182184
}

‎README.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# PAPasscode
2+
3+
PAPasscode is a standalone view controller for iOS to allow a user to set,
4+
enter or change a passcode. It's design to mimic the behaviour in Settings.app
5+
while still allowing some customization. It includes a sample project which
6+
shows how it appears on iPhone and iPad devices.
7+
8+
## Adding PAPasscode to your project
9+
10+
The simplest way to add PAPasscode to your project is to use [CocoaPods][http://cocoapods.org].
11+
Simply add the following line to your Podfile:
12+
13+
```
14+
pod 'PAPasscode'
15+
```
16+
17+
If you'd prefer to manually integrate it, simply copy `PAPasscode/*.{m,h}` and `Assets/*.png`
18+
into your project.
19+
20+
## Asking the user to set a passcode
21+
22+
First, implement the following delegate methods on your view controller:
23+
24+
```objective-c
25+
- (void)PAPasscodeViewControllerDidCancel:(PAPasscodeViewController *)controller {
26+
[self dismissViewControllerAnimated:YES completion:nil];
27+
}
28+
29+
- (void)PAPasscodeViewControllerDidSetPasscode:(PAPasscodeViewController *)controller {
30+
// Do stuff with controller.passcode...
31+
[self dismissViewControllerAnimated:YES completion:nil];
32+
}
33+
```

0 commit comments

Comments
 (0)