Skip to content

Instantly share code, notes, and snippets.

@mbbischoff
Created December 1, 2013 00:22
Show Gist options
  • Save mbbischoff/7726898 to your computer and use it in GitHub Desktop.
Save mbbischoff/7726898 to your computer and use it in GitHub Desktop.
Used instead of `hasText` due to an inscrutable bug in iOS 7.
#import <UIKit/UIKit.h>
@interface UITextField (LCKHacks)
/// Fixes a bug in UIKit where the `hasText` methods sometimes returns the string's length instead of a BOOL in iOS 7.0.x.
- (BOOL)actuallyHasText;
@end
#import "UITextField+LCKHacks.h"
@implementation UITextField (LCKHacks)
- (BOOL)actuallyHasText {
BOOL hasText = NO;
if ([self hasText]) {
hasText = YES;
}
return hasText;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment