Created
August 14, 2012 02:27
-
-
Save ryancole/3345817 to your computer and use it in GitHub Desktop.
A subclass of `UITextField` that has a prefixed label.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TitleField.h | |
// mustached-bear | |
// | |
// Created by Ryan Cole on 8/12/12. | |
// Copyright (c) 2012 Ryan Cole. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface TitleField : UITextField | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TitleField.m | |
// mustached-bear | |
// | |
// Created by Ryan Cole on 8/12/12. | |
// Copyright (c) 2012 Ryan Cole. All rights reserved. | |
// | |
#import "TitleField.h" | |
@implementation TitleField | |
- (void)awakeFromNib { | |
// init the padding view | |
UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, 20)]; | |
labelView.text = @"Title: "; | |
labelView.textAlignment = UITextAlignmentRight; | |
labelView.textColor = [UIColor colorWithWhite:0 alpha:0.6]; | |
// set the padding view | |
self.leftView = labelView; | |
self.leftViewMode = UITextFieldViewModeAlways; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment