Permalink
Browse files

[UI] Use TTIsStringWithAnyText in place of deprecated isEmptyOrWhiteS…

…pace.
  • Loading branch information...
1 parent d65fa67 commit 3240cf87f827d8230007fff447d3825d7edaa657 @jwang jwang committed with jverkoey Feb 16, 2011
@@ -43,6 +43,7 @@
#import "Three20Core/TTGlobalCoreLocale.h"
#import "Three20Core/TTGlobalCoreRects.h"
#import "Three20Core/NSStringAdditions.h"
+#import "Three20Core/TTGlobalCore.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -189,7 +190,8 @@ - (BOOL)hasEnteredText {
} else if ([field isKindOfClass:[TTMessageTextField class]]) {
UITextField* textField = [_fieldViews objectAtIndex:i];
- if (!textField.text.isEmptyOrWhitespace) {
+ if (TTIsStringWithAnyText(textField.text)
+ && !textField.text.isWhitespaceAndNewlines) {
return YES;
}
}
@@ -217,7 +219,7 @@ - (BOOL)hasRequiredText {
} else if ([field isKindOfClass:[TTMessageTextField class]]) {
UITextField* textField = [_fieldViews objectAtIndex:i];
- if (textField.text.isEmptyOrWhitespace) {
+ if (0 == textField.text.length || textField.text.isWhitespaceAndNewlines) {
return NO;
}
}
@@ -658,10 +660,13 @@ - (BOOL)fieldHasValueAtIndex:(NSUInteger)fieldIndex {
TTMessageField* field = [_fields objectAtIndex:fieldIndex];
if ([field isKindOfClass:[TTMessageRecipientField class]]) {
TTPickerTextField* pickerTextField = [_fieldViews objectAtIndex:fieldIndex];
- return !pickerTextField.text.isEmptyOrWhitespace || pickerTextField.cellViews.count > 0;
+ return (TTIsStringWithAnyText(pickerTextField.text)
+ && !pickerTextField.text.isWhitespaceAndNewlines)
+ || pickerTextField.cellViews.count > 0;
} else {
UITextField* textField = [_fieldViews objectAtIndex:fieldIndex];
- return !textField.text.isEmptyOrWhitespace;
+ return (TTIsStringWithAnyText(textField.text)
+ && !textField.text.isWhitespaceAndNewlines);
}
}
}
@@ -38,6 +38,7 @@
#import "Three20Core/TTGlobalCoreLocale.h"
#import "Three20Core/TTCorePreprocessorMacros.h"
#import "Three20Core/NSStringAdditions.h"
+#import "Three20Core/TTGlobalCore.h"
static const CGFloat kMarginX = 5;
static const CGFloat kMarginY = 6;
@@ -506,7 +507,8 @@ - (void)post {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)cancel {
- if (!_textView.text.isEmptyOrWhitespace
+ if (!TTIsStringWithAnyText(_textView.text)
+ && !_textView.text.isWhitespaceAndNewlines
&& !(_defaultText && [_defaultText isEqualToString:_textView.text])) {
UIAlertView* cancelAlertView = [[[UIAlertView alloc] initWithTitle:
TTLocalizedString(@"Cancel", @"")
@@ -39,6 +39,7 @@
#import "Three20Core/TTGlobalCoreLocale.h"
#import "Three20Core/TTCorePreprocessorMacros.h"
#import "Three20Core/NSStringAdditions.h"
+#import "Three20Core/TTGlobalCore.h"
static CGFloat kMargin = 1;
static CGFloat kPadding = 5;
@@ -410,7 +411,8 @@ - (void)post {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)cancel {
- if (!_textEditor.text.isEmptyOrWhitespace
+ if (!TTIsStringWithAnyText(_textEditor.text)
+ && !_textEditor.text.isWhitespaceAndNewlines
&& !(_defaultText && [_defaultText isEqualToString:_textEditor.text])) {
UIAlertView* cancelAlertView = [[[UIAlertView alloc] initWithTitle:
TTLocalizedString(@"Cancel", @"")

0 comments on commit 3240cf8

Please sign in to comment.