diff --git a/CHDropDownTextField/CHDropDownTextField.h b/CHDropDownTextField/CHDropDownTextField.h index 6c592ce..cbf9ca9 100644 --- a/CHDropDownTextField/CHDropDownTextField.h +++ b/CHDropDownTextField/CHDropDownTextField.h @@ -62,6 +62,16 @@ */ @property (nonatomic, assign) BOOL canPaste; +/** + Indicates the textfields text inset by Y. Defaults to 0. + */ +@property (nonatomic, assign) CGFloat dY; + +/** + Indicates the textfields text inset by X. Defaults to 0. + */ +@property (nonatomic, assign) CGFloat dX; + /** Indicates the drop-down's number of visible rows at a time. Defaults to 0. */ diff --git a/CHDropDownTextField/CHDropDownTextField.m b/CHDropDownTextField/CHDropDownTextField.m index 453eaf0..e4cb3af 100644 --- a/CHDropDownTextField/CHDropDownTextField.m +++ b/CHDropDownTextField/CHDropDownTextField.m @@ -204,6 +204,16 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { return [super canPerformAction:action withSender:sender]; } +// placeholder position +- (CGRect)textRectForBounds:(CGRect)bounds { + return CGRectInset(bounds, _dX, _dY); +} + +// text position +- (CGRect)editingRectForBounds:(CGRect)bounds { + return CGRectInset(bounds, _dX, _dY); +} + #pragma mark - UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {