Giter VIP home page Giter VIP logo

bezpickerview's Introduction

BEzPickerView

Customisable iOS horizontal picker. Lightweight and fast

Add the files in your project and play.

Usage

    CGRect frame = CGRectMake(2, 210, 282, 35);
    self.pickerView = [[BEzPicker alloc] initWithFrame:frame];
    self.pickerView.delegate = self;
    self.pickerView.dataSource = self;
    self.pickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self addSubview:self.pickerView];

    self.pickerView.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:20];
    self.pickerView.highlightedFont = [UIFont fontWithName:@"HelveticaNeue" size:20];
    self.pickerView.backgroundColor = [UIColor whiteColor];
    self.pickerView.interitemSpacing = 20.0;
    self.pickerView.fisheyeFactor = 0.001;
    self.pickerView.pickerViewStyle = BEzPickerViewStyle3D;
    self.pickerView.maskDisabled = false;

Pass the frame to adjust the position and size.

    CGRect frame = CGRectMake(2, 210, 282, 35);
    self.pickerView = [[BEzPicker alloc] initWithFrame:frame];

Customise the font and colors. You can add background color as well. Pass the data as following:

  self.titles = @[title,
                @"225-200-B",
                @"44-AA-BB-X",
                @"RR-22-09-A",
                @"BB-02-GH-P",
                @"NM-YU-OP-Q",
                @"VB-330-91-P",
                @"NN-HU-Q1-D",
                @"DF-90-11-HJ",
                @"TY-WE-02-DC"];

[self.pickerView reloadData];

Available functions

   #pragma mark - BEzPickerViewDataSource

  - (NSUInteger)numberOfItemsInPickerView:(BEzPicker *)pickerView
  {
      return [self.titles count];
  }
  - (NSString *)pickerView:(BEzPicker *)pickerView titleForItem:(NSInteger)item
  {
      return self.titles[item];
  }
  #pragma mark - BEzPickerDelegate

  - (void)pickerView:(BEzPicker *)pickerView didSelectItem:(NSInteger)item
  {
      //focused
  }

In your header file declare the delegate and datasource as following:

@interface ViewController : UIViewController<BEzPickerDelegate,BEzPickerViewDataSource>

bezpickerview's People

Contributors

mjm918 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

miramingo

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.