Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[UI] Use TTIsStringWithAnyText in place of deprecated isEmptyOrWhiteS…

…pace.
  • Loading branch information...
commit 3240cf87f827d8230007fff447d3825d7edaa657 1 parent d65fa67
@jwang jwang authored jverkoey committed
View
13 src/Three20UI/Sources/TTMessageController.m
@@ -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);
}
}
}
View
4 src/Three20UI/Sources/TTPostController.m
@@ -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", @"")
View
4 src/Three20UI/Sources/TTTextBarController.m
@@ -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", @"")
Please sign in to comment.
Something went wrong with that request. Please try again.