Permalink
Browse files

* Update README to make instructions regarding the compiler flags mor…

…e clear

* Remove some NSString additions in favor of methods that were already there
* New NSDate additions
* Other minor fixes
  • Loading branch information...
1 parent 3b0044d commit 3274e6d0515bbbcbdbabe8ef2a411ae1efded092 Joe Hewitt committed May 14, 2009
View
@@ -43,10 +43,12 @@ Three20 is compiled as a static library, and the easiest way to add it to your p
7. Finally, we need to tell your project where to find the Three20 headers. Open your
"Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click
- it. Add the relative path from your project's directory to the "three20/src" directory. Then
- go to "Other Linker Flags" under the "Linker" section, and add "-ObjC" to the list of flags.
+ it. Add the relative path from your project's directory to the "three20/src" directory.
-8. You're ready to go. Just #import "Three20/Three20.h" anywhere you want to use Three20 classes
+8. While you are in Project Settings, go to "Other Linker Flags" under the "Linker" section, and
+ add "-ObjC" to the list of flags.
+
+9. You're ready to go. Just #import "Three20/Three20.h" anywhere you want to use Three20 classes
in your project.
What's in Three20?
View
@@ -0,0 +1,13 @@
+#import "Three20/TTGlobal.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@implementation NSDate (TTCategory)
+
++ (id)dateWithToday {
+ NSString* format = @"%Y-%m-%d 00:00:00 +0700";
+ NSString* time = [[NSDate date] descriptionWithCalendarFormat:format timeZone:nil locale:nil];
+ return [self dateWithString:time];
+}
+
+@end
@@ -15,29 +15,6 @@ - (BOOL)isWhitespace {
return YES;
}
-- (BOOL)beginsWithString:(NSString*)substring {
- if (self.length < substring.length) {
- return NO;
- } else {
- NSRange searchRange = NSMakeRange(0, substring.length);
- NSRange range = [self rangeOfString:substring options:0 range:searchRange];
- return range.location == searchRange.location;
- }
-}
-
-- (BOOL)endsWithString:(NSString*)substring {
- if (self.length < substring.length) {
- return NO;
- } else {
- NSRange searchRange = NSMakeRange(self.length - substring.length, substring.length);
- NSRange range = [self rangeOfString:substring options:0 range:searchRange];
- return range.location == searchRange.location;
- }
-
- NSRange range = [self rangeOfString:substring];
- return range.location == self.length - substring.length;
-}
-
// Copied and pasted from http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg28175.html
- (NSDictionary*)queryDictionaryUsingEncoding: (NSStringEncoding)encoding {
NSCharacterSet* delimiterSet = [NSCharacterSet characterSetWithCharactersInString:@"&;"];
@@ -236,6 +236,7 @@ - (void)reloadTable {
if ((![_dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]
|| [_dataSource numberOfSectionsInTableView:_tableView])
&& [_dataSource tableView:_tableView numberOfRowsInSection:0]) {
+ [self layoutIfNeeded];
[self showSearchResults:YES];
[self.tableView reloadData];
} else {
@@ -452,7 +453,7 @@ - (CGRect)rectForSearchResults:(BOOL)withKeyboard {
y += view.top;
view = view.superview;
}
-
+
CGFloat height = self.height;
CGFloat keyboardHeight = withKeyboard ? KEYBOARD_HEIGHT : 0;
CGFloat tableHeight = self.window.height - (self.screenY + height + keyboardHeight);
@@ -66,9 +66,9 @@ - (void)dealloc {
- (void)drawRect:(CGRect)rect {
if (_highlighted) {
- [_highlightedTextColor setFill];
+ [self.highlightedTextColor setFill];
} else {
- [_textColor setFill];
+ [self.textColor setFill];
}
CGPoint origin = CGPointMake(rect.origin.x + _contentInset.left,
@@ -186,6 +186,7 @@ - (NSData *)parser:(NSXMLParser *)parser resolveExternalEntityName:(NSString *)e
entityTable = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSData dataWithBytes:" " length:1], @"nbsp",
[NSData dataWithBytes:"&" length:1], @"amp",
+ [NSData dataWithBytes:"\"" length:1], @"quot",
[NSData dataWithBytes:"<" length:1], @"lt",
[NSData dataWithBytes:">" length:1], @"gt",
nil];
@@ -41,6 +41,8 @@
BE8AA1930F428A4900FD8C43 /* UIViewControllerAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8AA1920F428A4900FD8C43 /* UIViewControllerAdditions.h */; };
BEA69ECB0FAC0FD600DA7DDC /* TTWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEA69ECA0FAC0FD600DA7DDC /* TTWebController.m */; };
BEA69ECD0FAC0FEC00DA7DDC /* TTWebController.h in Headers */ = {isa = PBXBuildFile; fileRef = BEA69ECC0FAC0FEC00DA7DDC /* TTWebController.h */; };
+ BEA7624E0FBA1E220091B567 /* NSDateAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BEA7624D0FBA1E220091B567 /* NSDateAdditions.m */; };
+ BEA762500FBA1E290091B567 /* NSDateAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = BEA7624F0FBA1E290091B567 /* NSDateAdditions.h */; };
BEAF21220F4D329600D75F3B /* NSObjectAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAF211B0F4D329600D75F3B /* NSObjectAdditions.m */; };
BEAF21230F4D329600D75F3B /* UIColorAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAF211C0F4D329600D75F3B /* UIColorAdditions.m */; };
BEAF21240F4D329600D75F3B /* UIImageAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BEAF211D0F4D329600D75F3B /* UIImageAdditions.m */; };
@@ -175,6 +177,8 @@
BE8AA1920F428A4900FD8C43 /* UIViewControllerAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIViewControllerAdditions.h; path = Three20/UIViewControllerAdditions.h; sourceTree = "<group>"; };
BEA69ECA0FAC0FD600DA7DDC /* TTWebController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTWebController.m; sourceTree = "<group>"; };
BEA69ECC0FAC0FEC00DA7DDC /* TTWebController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TTWebController.h; path = Three20/TTWebController.h; sourceTree = "<group>"; };
+ BEA7624D0FBA1E220091B567 /* NSDateAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDateAdditions.m; sourceTree = "<group>"; };
+ BEA7624F0FBA1E290091B567 /* NSDateAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSDateAdditions.h; path = Three20/NSDateAdditions.h; sourceTree = "<group>"; };
BEAF211B0F4D329600D75F3B /* NSObjectAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSObjectAdditions.m; sourceTree = "<group>"; };
BEAF211C0F4D329600D75F3B /* UIColorAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIColorAdditions.m; sourceTree = "<group>"; };
BEAF211D0F4D329600D75F3B /* UIImageAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageAdditions.m; sourceTree = "<group>"; };
@@ -366,6 +370,8 @@
BEAF211B0F4D329600D75F3B /* NSObjectAdditions.m */,
BEB210D30FA3E784007DEE5F /* NSStringAdditions.h */,
BEB210D10FA3E77E007DEE5F /* NSStringAdditions.m */,
+ BEA7624F0FBA1E290091B567 /* NSDateAdditions.h */,
+ BEA7624D0FBA1E220091B567 /* NSDateAdditions.m */,
BED623910F50F34B003EF242 /* NSArrayAdditions.h */,
BED623930F50F350003EF242 /* NSArrayAdditions.m */,
BEAF21360F4D32E100D75F3B /* UIColorAdditions.h */,
@@ -619,6 +625,7 @@
BE1942770F9ACE85005F4EFC /* TTStyledLayout.h in Headers */,
BEB210D40FA3E784007DEE5F /* NSStringAdditions.h in Headers */,
BEA69ECD0FAC0FEC00DA7DDC /* TTWebController.h in Headers */,
+ BEA762500FBA1E290091B567 /* NSDateAdditions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -725,6 +732,7 @@
BE1942880F9ACEA7005F4EFC /* TTStyledLayout.m in Sources */,
BEB210D20FA3E77E007DEE5F /* NSStringAdditions.m in Sources */,
BEA69ECB0FAC0FD600DA7DDC /* TTWebController.m in Sources */,
+ BEA7624E0FBA1E220091B567 /* NSDateAdditions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,8 @@
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@interface NSDate (TTCategory)
+
++ (id)dateWithToday;
+
+@end
@@ -5,9 +5,6 @@
- (BOOL)isWhitespace;
-- (BOOL)beginsWithString:(NSString*)substring;
-- (BOOL)endsWithString:(NSString*)substring;
-
- (NSDictionary*)queryDictionaryUsingEncoding: (NSStringEncoding)encoding;
@end
@@ -2,6 +2,7 @@
#import <UIKit/UIKit.h>
#import "Three20/NSObjectAdditions.h"
#import "Three20/NSStringAdditions.h"
+#import "Three20/NSDateAdditions.h"
#import "Three20/NSArrayAdditions.h"
#import "Three20/UIColorAdditions.h"
#import "Three20/UIImageAdditions.h"

0 comments on commit 3274e6d

Please sign in to comment.