Git Product home page Git Product logo

papasscode's Introduction

PAPasscode

PAPasscode is a standalone view controller for iOS to allow a user to set, enter or change a passcode. It's designed to mimic the behaviour in Settings.app while still allowing some customization. It includes a sample project which shows how it appears on iPhone and iPad devices.

screen1 screen2

Other features:

  • Supports both simple (PIN-style) and regular passcodes
  • Allows customization of title and prompts
  • Animates screens left and right
  • Requires ARC

Adding PAPasscode to your project

The simplest way to add PAPasscode to your project is to use CocoaPods. Simply add the following line to your Podfile:

	pod 'PAPasscode'

If you'd prefer to manually integrate it, simply copy PAPasscode/*.{m,h} and Assets/*.png into your project. Make sure you link with the QuartzCore framework.

Asking the user to set a passcode

First, implement the following delegate methods on your view controller:

- (void)PAPasscodeViewControllerDidCancel:(PAPasscodeViewController *)controller {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)PAPasscodeViewControllerDidSetPasscode:(PAPasscodeViewController *)controller {
	// Do stuff with controller.passcode...
    [self dismissViewControllerAnimated:YES completion:nil];
}

Then invoke the view controller as follows:

    PAPasscodeViewController *passcodeViewController = [[PAPasscodeViewController alloc] initForAction:PasscodeActionSet];
    passcodeViewController.delegate = self;
    [self presentViewController:[[UINavigationController alloc] initWithRootViewController:passcodeViewController] animated:YES completion:nil];

The initForAction: allows you to specify the flow you'd like. Possible actions are:

  • PasscodeActionSet - set a new passcode
  • PasscodeActionEnter - enter an existing passcode
  • PasscodeActionChange - change an existing passcode

The included example project demonstrates the each of the flows.

Changelog

1.0

  • Update to support auto-layout and change UI to match iOS 7 styling. Note that if you require support for iOS 6, you should stick with version 0.3.

0.3

  • The PAPasscodeViewControllerDidCancel: delegate method is now optional. If missing, then the Cancel button will be removed.

0.2

  • Add property to specify custom background view

0.1

  • Initial release

Contact

To hear about updates to this and other libraries follow me on Twitter (@denishennessy) or App.net (@denishennessy).

If you encounter a bug or just thought of a terrific new feature, then opening a github issue is probably the best way to share it. Actually, the best way is to send me a pull request...

For anything else, email always works: [email protected]

License

Copyright (c) 2012-2015, Denis Hennessy (Peer Assembly - http://peerassembly.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of Peer Assembly, Denis Hennessy nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL PEER ASSEMBLY OR DENIS HENNESSY BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

papasscode's People

Contributors

dhennessy avatar dylanhand avatar jarlehansen avatar mcicak avatar sumardi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

papasscode's Issues

Input buttons for iPad

Can you add input buttons on iPad rather than using the default keyboard? Similar to how the native lockscreen works.

Here is an image of what I mean: image

Dark mode not supported?

PAPasscode looks fine on Light mode, but on Dark mode, labels are in white-text-color, while view background is light.

Expected: view background should be dark.

Cosmetic error when launching iPad in Landscape orientation

When I launch an app using implemented PAPasscode with the iPad simulator or actual device in landscape orientation, when the passcode view is presented, it is clipped at the top. See image. I am initiating the PAPasscodeViewController in a DetailViewController of a Master/Detail view example (using UISplitViewController).

image

Not secure enough

This control is not secure enough. When the iPhone is jailbroken, you could attach the debugger and dismiss the modalviewcontroller.

After calling PAPasscode, Cursor in all text fields are invisible?

I am pulling the library through cocoapods.

Every time I give focus to some UITextfield after PAPasscode is closed, the cursor disappears..

This is happening on iOS8

PAPasscode itself appears to work properly and I copied the way you've instantiated it in your demo.

iPad hide keyboard button, cannot enter passcode?

On an iPad, using the passcode viewcontroller without a cancel button. It is possible for the user to hide the keyboard. However, I seem to be unable to show the keyboard again.

  1. Is it possible to avoid presenting the "hide keyboard" button at all?
  2. If not, how can the keyboard be shown again? I was able to create a workaround for this by listening to "UIKeyboardDidHideNotification", but there might be better solutions?

Thanks,
Jarle

I am a xcode beginner

I put the code below in method viewDidLoad,
PAPasscodeViewController *passcodeViewController = [[PAPasscodeViewController alloc] initForAction:PasscodeActionEnter];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
passcodeViewController.backgroundView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
}
passcodeViewController.delegate = self;
passcodeViewController.passcode = @"0000";
passcodeViewController.alternativePasscode = @"9999";
passcodeViewController.simple = YES;
[self presentViewController:passcodeViewController animated:YES completion:nil];

But it did not popup for entering passcode. Where did I go wrong ?
Sorry, I am a beginner.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.