# XLCarPlateInputView **Repository Path**: ilongge/XLCarPlateInputView ## Basic Information - **Project Name**: XLCarPlateInputView - **Description**: XLCarPlateInputView - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-08-01 - **Last Updated**: 2022-08-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # XLCarPlateInputView ```ruby pod 'XLCarPlateInputView' ``` ![QQ20220801-154155@2x.png](https://s2.loli.net/2022/08/01/ndwWcJM57iupbmU.png) ![QQ20220801-154208@2x.png](https://s2.loli.net/2022/08/01/jIsqfG5cV7UO8Ee.png) ![QQ20220801-154225@2x.png](https://s2.loli.net/2022/08/01/zg4yeDf2qPRZATI.png) ```Objectivce-C @property (weak, nonatomic) IBOutlet UITextField *carPlateTextField; ``` ```Objectivce-C CGFloat inputHeight = kBottomSafeHeight + 300; CGRect inputRect = CGRectMake(0, SCREEN_HEIGHT - inputHeight, SCREEN_WIDTH, inputHeight); XLCarPlateInputView *inputView = [[XLCarPlateInputView alloc] initWithFrame:inputRect]; inputView.carPlate = self.carPlateTextField.text; self.carPlateTextField.inputView = inputView; [self.carPlateTextField reloadInputViews]; WS(weakSelf); inputView.doneButtonBlock = ^(NSString *stringValue) { StrongSelf(strongSelf); [strongSelf carPlateInputDone:stringValue]; }; inputView.cancelButtonBlock = ^{ StrongSelf(strongSelf); [strongSelf carPlateInputCancel]; }; inputView.specialButtonBlock = ^{ StrongSelf(strongSelf); [strongSelf carPlateInputSpecial]; }; ``` ```Objectivce-C - (void)carPlateInputDone:(NSString *)stringValue { [self.view.window endEditing:YES]; self.carPlateTextField.text = stringValue; [self.carPlateTextField resignFirstResponder]; } - (void)carPlateInputCancel { [self.carPlateTextField resignFirstResponder]; } - (void)carPlateInputSpecial { [self.view.window endEditing:YES]; self.carPlateTextField.inputView = nil; [self.carPlateTextField becomeFirstResponder]; [self.carPlateTextField reloadInputViews]; } ```