Skip to content

Instantly share code, notes, and snippets.

@brynbodayle
Created November 18, 2013 03:58
Show Gist options
  • Save brynbodayle/7522244 to your computer and use it in GitHub Desktop.
Save brynbodayle/7522244 to your computer and use it in GitHub Desktop.
Fix for UILabel attributedPlaceholder not allowing a placeholder font different than the label's text font.
#import "CustomTextField.h"
@interface CustomTextField()
@property (nonatomic, strong) NSAttributedString *originalAttribtuedPlaceholder;
@end
@implementation CustomTextField
- (void) drawPlaceholderInRect:(CGRect)rect {
[self.originalAttribtuedPlaceholder drawWithRect:rect options:NSStringDrawingUsesLineFragmentOrigin context:NULL];
}
- (void)setAttributedPlaceholder:(NSAttributedString *)attributedPlaceholder {
self.originalAttribtuedPlaceholder = attributedPlaceholder;
[super setAttributedPlaceholder:attributedPlaceholder];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment