Giter Site home page Giter Site logo

akpickerview's Introduction

AKPickerView

Build Status

Screenshot Screenshot2

A simple yet customizable horizontal picker view.

Works on iOS 6, 7 and 8.

News: AKPickerView now supports images!

Installation

Use CocoaPods

pod "AKPickerView"

…or simply add AKPickerView.h/m into your project.

Usage

  1. Instantiate and set delegate as you know,

     self.pickerView = [[AKPickerView alloc] initWithFrame:<#frame#>];
     self.pickerView.delegate = self;
    
  2. then specify the number of items using delegate methods,

     - (NSUInteger)numberOfItemsInPickerView:(AKPickerView *)pickerView;
    
  3. and specify contents to be shown. You can use either texts or images:

     - (NSString *)pickerView:(AKPickerView *)pickerView titleForItem:(NSInteger)item;
     // OR
     - (UIImage *)pickerView:(AKPickerView *)pickerView imageForItem:(NSInteger)item;
    
    • Using both texts and images are currently not supported. When you implement both, -pickerView:titleForItem will be called and the other won't.
    • You currently cannot specify image sizes; AKPickerView shows the original image in its original size. Resize your images in advance if you need.
  4. You can change its appearance with properties below.

     @property (nonatomic, strong) UIFont *font;
     @property (nonatomic, strong) UIFont *highlightedFont;
     @property (nonatomic, strong) UIColor *textColor;
     @property (nonatomic, strong) UIColor *highlightedTextColor;
     @property (nonatomic, assign) CGFloat interitemSpacing;
     @property (nonatomic, assign) CGFloat fisheyeFactor;
    
    • All cells are laid out depending on the largest font, so large differnce between the sizes of font and highlightedFont is NOT recommended.
    • fisheyeFactor property affects perspective distortion. The range is 0.0 - 1.0; slight value such as 0.0001 is recommended.

After all settings, never forget to reload your picker.

[self.pickerView reloadData];

For more detail, see the sample project.

Contact

@akkyie http://twitter.com/akkyie

License

See LICENSE.

akpickerview's People

Contributors

akkyie avatar phatmann avatar rinatkhanov avatar tifroz avatar wcwynn avatar

Watchers

 avatar  avatar

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.