wahkiz / SFViewController

Your iPhone 5 is too long and your fingers are too short. Use ShortFingerViewController.

Home Page:https://github.com/remaerd/SFViewController

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WHY

iPhone 5 is now longer, people with shorter fingers will find the navigation bar controls less accessible.

ShortFingerViewController adds 'gesture' abilities to UIViewController/UITableViewController, which allows a downwards gesture to dismiss a ModalView, or a right swipe to dismiss a View Controller.

HOW

开始使用 ShortFingerViewController (Using ShortFingerViewController)

ShortFingerViewController will subclass UIViewController API's. This allows you to use it without doing major revisions to your existing code.

  1. Once downloaded, drag SFViewController folder along with it's contents into your XCode Project files.

  2. When SFViewController is needed for your View Controller, use '#import' and import SFViewController.h. If it is a UITableViewController, import SFTableViewController.h. For example : #import "SFTableViewController.h"

  3. Change the Superclass for the header file to SFViewController. For example : @interface MainViewController : SFViewController

  4. Include the function didPanToPositionX or didPanToPositionY to determine whether such gesture has been invoked, dismiss your view controllers with it, e.g : - (void)didPanToPositionX{[self dismissModalViewControllerAnimated:YES];}

  5. If you are using a Storyboard or Nib file, you will to create a specific IBOutlet. Open up your Assistant Editor (as shown in the picture below), within the Interface Builder, locate your TableView, right click on it and drag a connection towards the relevant class header file. Name the created IBOutlet as tableView. This will ensure that your design will conform to the inner workings of SFViewController.

As long as the above instructions are followed, ShortFingerViewController will perform as expected.

可选项 (Options)

ShortFingerViewController brings a set of options, this includes

  • presentSpeed 显示速度 (shows the speed)
  • previousViewMaskColor 显示 ModalView 时背景 View 的背景颜色 (shows the Shadow Color overlayed on the View below your ModalView)
  • previousViewMaskAlpha 显示 ModalView 时背景 View 的透明度 (shows the Shadow layer's alpha for the View below your ModalView)
  • enableVerticalPull 允许纵向拖动 (allows Vertical movement)
  • enableHorizontalPull 允许横向拖动 (allows Horizontal Movement)
  • positionX X 数值,在大于这个数值时激活 didPanToPositionX (X value that determines the invocation of didPanToPositionX)
  • positionY Y 数值,在大于这个数值时激活 didPanToPositionY (Y value that determines the invocation of didPanToPositionY)

背景 Background

SFViewController comes with two images, mainly for TableView's background. If your TableView requires the standard background, you are required to place the images into your project.

Through navigationBackgroundColor ,you can determine what colors or images are to be shown. Within 'loadView' or 'viewDidLoad', add for example : [self setNavigationBackgroundColor:[UIColor redColor]];.

When different ViewController is being presented, the standard background will be automatically used. If your ViewControllers uses the same background, you need to set up a background for each ViewControllers, if not the ViewController will present the standard background.

ME

ShortFingerViewController is originally written by Sean Cheng for an app named CloudsFM. This is his first time writing Public Code, and he is glad that he did it. He hopes you too will find this code useful. If there is any bugs within the code, do not hesitate to contact him. Thanks!

About

Your iPhone 5 is too long and your fingers are too short. Use ShortFingerViewController.

https://github.com/remaerd/SFViewController

License:MIT License


Languages

Language:Objective-C 100.0%