Skip to content

Instantly share code, notes, and snippets.

@csknns
Last active August 29, 2015 14:13
Show Gist options
  • Save csknns/9b9cf701b3d521f6820b to your computer and use it in GitHub Desktop.
Save csknns/9b9cf701b3d521f6820b to your computer and use it in GitHub Desktop.
TextFieldsWithInsets
//
// TextFieldsWithInsets.h
//
//
// Created by Christos Koninis on 11/26/12.
//
//
#import <UIKit/UIKit.h>
@interface TextFieldsWithInsets : UITextField
@end
//
// TextFieldsWithInsets.m
//
//
// Created by Christos Koninis on 11/26/12.
//
//
#import "TextFieldsWithInsets.h"
@implementation TextFieldsWithInsets
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
// placeholder position
- (CGRect)textRectForBounds:(CGRect)bounds {
return CGRectInset( bounds , 15 , 0 );
}
// text position
- (CGRect)editingRectForBounds:(CGRect)bounds {
return CGRectInset( bounds , 15 , 0 );
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment