Giter Site home page Giter Site logo

huinputview's Introduction

#HUInputView---自定义数字键盘


###主要功能:自定义数字键盘,支持随机数字键盘。长按删除功能。 image

####技术点:

1.删除按钮,长按删除功能。

2.随机数字键盘

####解决方式:

1.删除键为UIbutton,长按删除原理:为此按钮添加长按手势,触动长按相关方法,开启定时器(UIGestureRecognizerStateBegan),循环进行删除操作!并在长按手势结束后,停止定时器(UIGestureRecognizerStateEnded)!

2.随机数字键盘原理:

- (NSMutableArray *) randomizedArrayWithArray:(NSArray *)array {
    
    NSMutableArray *results = [[NSMutableArray alloc]initWithArray:array];
    
    NSInteger i = [results count];
    
    while(--i > 0) {
        
        int j = rand() % (i+1);
        
        [results exchangeObjectAtIndex:i withObjectAtIndex:j];
    }
    
    return results;
    
}

####使用方法:

    UITextField *textF = [[UITextField alloc] initWithFrame:CGRectMake(10, 220, 300, 50)];
    textF.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:textF];
    textF.inputView.backgroundColor = [UIColor redColor];
    textF.inputView = [[HUNumInputView alloc] initIsRandom:NO mainView:textF];

huinputview's People

Contributors

wyhu avatar

Stargazers

 avatar 谁能叫我布朗 avatar

Watchers

James Cloos 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.