Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ak2consulting/three20
base: master
...
head fork: jdelStrother/three20
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 12 commits
  • 40 files changed
  • 0 commit comments
  • 2 contributors
Commits on May 14, 2009
Joe Hewitt * 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
3274e6d
Commits on May 20, 2009
@joehewitt joehewitt * Various minor bug fixes 35ed4fd
Commits on May 21, 2009
@joehewitt joehewitt * Fix calls to bad NSDate method 87059e9
Commits on May 27, 2009
@joehewitt joehewitt * Minor fixes 57bd904
Commits on May 29, 2009
@joehewitt joehewitt * Fix the photo viewer and message composer is iPhone OS 3.0 d77ad02
@joehewitt joehewitt * One more iPhone OS 3.0 fix
* Merged code from hboon
d75eef3
Commits on Jun 02, 2009
@joehewitt joehewitt * Better way to check for OS 3.0-specific code
* Shrink font a bit for titled table cells
* Fix a crash in text view table cells
c3c8ceb
Commits on Jun 03, 2009
@joehewitt joehewitt * New table cell for displaying a search bar
* New date category method for getting a date at midnight
* Fix styles of tab grids with only one row of tabs
1a71688
Commits on Jun 04, 2009
@joehewitt joehewitt * Ability to zoom the photo view controller to fit, and detect when i…
…t is zoomed

* New badge variation with smaller font size
b789448
Commits on Jun 10, 2009
@joehewitt joehewitt * Method to create an NSURLRequest from a TTURLRequest
* Method to load a request in a TTWebController
* Bug fixes in search bars
b5e86f3
Commits on Jun 12, 2009
Jonathan del Strother Fix leak on -[TTURLRequestLoader cancel:] bf49af8
Commits on Jul 03, 2009
Jonathan del Strother SDKROOT -> 3.0, DEPLOYMENT_TARGET -> 2.2.1
Having a nightmare persuading my app to run on both 2.2.1 & 3.0 without hardcoding these settings in three20's xcodeproj
Not quite ready to move to 3.0-only yet...
83ff6e5
Showing with 407 additions and 150 deletions.
  1. +1 −1  .gitignore
  2. +5 −3 README.mdown
  3. +8 −0 samples/TTCatalog/TTCatalog.xcodeproj/project.pbxproj
  4. +25 −0 src/NSDateAdditions.m
  5. +0 −23 src/NSStringAdditions.m
  6. +27 −3 src/TTDefaultStyleSheet.m
  7. +20 −0 src/TTGlobal.m
  8. +5 −1 src/TTMessageController.m
  9. +31 −19 src/TTPhotoViewController.m
  10. +9 −5 src/TTScrollView.m
  11. +3 −2 src/TTSearchBar.m
  12. +14 −12 src/TTSearchTextField.m
  13. +1 −1  src/TTStyledFrame.m
  14. +4 −3 src/TTStyledTextLabel.m
  15. +1 −0  src/TTStyledTextParser.m
  16. +32 −19 src/TTTabBar.m
  17. +1 −10 src/TTTableField.m
  18. +51 −0 src/TTTableFieldCell.m
  19. +2 −2 src/TTTableView.m
  20. +4 −1 src/TTTableViewDataSource.m
  21. +0 −1  src/TTThumbsTableViewCell.m
  22. +18 −7 src/TTThumbsViewController.m
  23. +4 −0 src/TTURLRequest.m
  24. +35 −24 src/TTURLRequestQueue.m
  25. +6 −2 src/TTWebController.m
  26. +12 −2 src/Three20.xcodeproj/project.pbxproj
  27. +10 −0 src/Three20/NSDateAdditions.h
  28. +0 −3  src/Three20/NSStringAdditions.h
  29. +2 −0  src/Three20/TTDefaultStyleSheet.h
  30. +11 −0 src/Three20/TTGlobal.h
  31. +10 −0 src/Three20/TTScrollView.h
  32. +6 −1 src/Three20/TTTabBar.h
  33. +0 −2  src/Three20/TTTableField.h
  34. +7 −1 src/Three20/TTTableFieldCell.h
  35. +1 −0  src/Three20/TTThumbsViewController.h
  36. +2 −0  src/Three20/TTURLRequest.h
  37. +5 −0 src/Three20/TTURLRequestQueue.h
  38. +1 −0  src/Three20/TTWebController.h
  39. +5 −2 src/Three20/UIViewAdditions.h
  40. +28 −0 src/UIViewAdditions.m
View
2  .gitignore
@@ -2,5 +2,5 @@
build
*.pbxuser
*.perspectivev3
-*.modelv3
+*.mode1v3
.DS_Store
View
8 README.mdown
@@ -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" and "-all_load" 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
8 samples/TTCatalog/TTCatalog.xcodeproj/project.pbxproj
@@ -388,6 +388,10 @@
GCC_PREFIX_HEADER = TTCatalog_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
INFOPLIST_FILE = Info.plist;
+ OTHER_LDFLAGS = (
+ "-all_load",
+ "-ObjC",
+ );
PRODUCT_NAME = TTCatalog;
};
name = Debug;
@@ -400,6 +404,10 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = TTCatalog_Prefix.pch;
INFOPLIST_FILE = Info.plist;
+ OTHER_LDFLAGS = (
+ "-all_load",
+ "-ObjC",
+ );
PRODUCT_NAME = TTCatalog;
};
name = Release;
View
25 src/NSDateAdditions.m
@@ -0,0 +1,25 @@
+#import "Three20/TTGlobal.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@implementation NSDate (TTCategory)
+
++ (NSDate*)dateWithToday {
+ NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
+ formatter.dateFormat = @"yyyy-d-M";
+
+ NSString* time = [formatter stringFromDate:[NSDate date]];
+ NSDate* date = [formatter dateFromString:time];
+ return date;
+}
+
+- (NSDate*)dateAtMidnight {
+ NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
+ formatter.dateFormat = @"yyyy-d-M";
+
+ NSString* time = [formatter stringFromDate:self];
+ NSDate* date = [formatter dateFromString:time];
+ return date;
+}
+
+@end
View
23 src/NSStringAdditions.m
@@ -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:@"&;"];
View
30 src/TTDefaultStyleSheet.m
@@ -181,7 +181,7 @@ - (TTStyle*)whiteBezel {
[TTSolidBorderStyle styleWithColor:RGBCOLOR(178, 178, 178) width:1 next:nil]]];
}
-- (TTStyle*)badge {
+- (TTStyle*)badgeWithFontSize:(CGFloat)fontSize {
return
[TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(1, 1, 1, 1) next:
@@ -189,11 +189,19 @@ - (TTStyle*)badge {
[TTReflectiveFillStyle styleWithColor:RGBCOLOR(221, 17, 27) next:
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1, -1, -1, -1) next:
[TTSolidBorderStyle styleWithColor:[UIColor whiteColor] width:2 next:
- [TTBoxStyle styleWithPadding:UIEdgeInsetsMake(1, 6, 3, 6) next:
- [TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:13]
+ [TTBoxStyle styleWithPadding:UIEdgeInsetsMake(2, 7, 2, 7) next:
+ [TTTextStyle styleWithFont:[UIFont boldSystemFontOfSize:fontSize]
color:[UIColor whiteColor] next:nil]]]]]]]];
}
+- (TTStyle*)miniBadge {
+ return [self badgeWithFontSize:12];
+}
+
+- (TTStyle*)badge {
+ return [self badgeWithFontSize:15];
+}
+
- (TTStyle*)tabBar {
UIColor* border = [TTSTYLEVAR(tabBarTintColor) multiplyHue:0 saturation:0 value:0.7];
return
@@ -238,6 +246,10 @@ - (TTStyle*)tabGridTab:(UIControlState)state corner:(short)corner {
shape = [TTRoundedRectangleShape shapeWithTopLeft:0 topRight:0 bottomRight:8 bottomLeft:0];
} else if (corner == 4) {
shape = [TTRoundedRectangleShape shapeWithTopLeft:0 topRight:0 bottomRight:0 bottomLeft:8];
+ } else if (corner == 5) {
+ shape = [TTRoundedRectangleShape shapeWithTopLeft:8 topRight:0 bottomRight:0 bottomLeft:8];
+ } else if (corner == 6) {
+ shape = [TTRoundedRectangleShape shapeWithTopLeft:0 topRight:8 bottomRight:8 bottomLeft:0];
} else {
shape = [TTRectangleShape shape];
}
@@ -283,6 +295,14 @@ - (TTStyle*)tabGridTabBottomLeft:(UIControlState)state {
return [self tabGridTab:state corner:4];
}
+- (TTStyle*)tabGridTabLeft:(UIControlState)state {
+ return [self tabGridTab:state corner:5];
+}
+
+- (TTStyle*)tabGridTabRight:(UIControlState)state {
+ return [self tabGridTab:state corner:6];
+}
+
- (TTStyle*)tabGridTabCenter:(UIControlState)state {
return [self tabGridTab:state corner:0];
}
@@ -474,6 +494,10 @@ - (UIFont*)tableTitleFont {
return [UIFont boldSystemFontOfSize:13];
}
+- (UIFont*)tableTitleValueFont {
+ return [UIFont boldSystemFontOfSize:15];
+}
+
- (UIFont*)tableButtonFont {
return [UIFont boldSystemFontOfSize:13];
}
View
20 src/TTGlobal.m
@@ -89,6 +89,26 @@ void TTNetworkRequestStopped() {
}
}
+float TTOSVersion() {
+ return [[[UIDevice currentDevice] systemVersion] floatValue];
+}
+
+BOOL TTOSVersionIsAtLeast(float version) {
+ #ifdef __IPHONE_3_0
+ return 3.0 >= version;
+ #endif
+ #ifdef __IPHONE_2_2
+ return 2.2 >= version;
+ #endif
+ #ifdef __IPHONE_2_1
+ return 2.1 >= version;
+ #endif
+ #ifdef __IPHONE_2_0
+ return 2.0 >= version;
+ #endif
+ return NO;
+}
+
NSLocale* TTCurrentLocale() {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defaults objectForKey:@"AppleLanguages"];
View
6 src/TTMessageController.m
@@ -326,7 +326,11 @@ - (void)loadView {
CGRect innerFrame = CGRectMake(0, TOOLBAR_HEIGHT,
appFrame.size.width, appFrame.size.height - (TOOLBAR_HEIGHT+KEYBOARD_HEIGHT));
- _scrollView = [[TTComposeInnerScrollView alloc] initWithFrame:innerFrame];
+ if (TTOSVersionIsAtLeast(3.0)) {
+ _scrollView = [[[UIScrollView class] alloc] initWithFrame:innerFrame];
+ } else {
+ _scrollView = [[[TTComposeInnerScrollView class] alloc] initWithFrame:innerFrame];
+ }
_scrollView.backgroundColor = TTSTYLEVAR(backgroundColor);
_scrollView.canCancelContentTouches = NO;
_scrollView.showsVerticalScrollIndicator = NO;
View
50 src/TTPhotoViewController.m
@@ -3,6 +3,7 @@
#import "Three20/TTURLRequest.h"
#import "Three20/TTUnclippedView.h"
#import "Three20/TTPhotoView.h"
+#import "Three20/TTURLRequestQueue.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -42,11 +43,16 @@ - (id)init {
self.navigationBarStyle = UIBarStyleBlackTranslucent;
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
+
+ if ([self respondsToSelector:@selector(setWantsFullScreenLayout:)]) {
+ [self setWantsFullScreenLayout:YES];
+ }
}
return self;
}
- (void)dealloc {
+ [[TTURLRequestQueue mainQueue] cancelRequestsWithDelegate:self];
[_thumbsController release];
[_slideshowTimer invalidate];
_slideshowTimer = nil;
@@ -294,18 +300,20 @@ - (void)previousAction {
}
- (void)showBarsAnimationDidStop {
- _innerView.top = -CHROME_HEIGHT;
- self.view.top = TOOLBAR_HEIGHT;
- self.view.height -= TOOLBAR_HEIGHT;
-
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ _innerView.top = -CHROME_HEIGHT;
+ self.view.top = TOOLBAR_HEIGHT;
+ self.view.height -= TOOLBAR_HEIGHT;
+ }
self.navigationController.navigationBarHidden = NO;
}
- (void)hideBarsAnimationDidStop {
- _innerView.top = -STATUS_HEIGHT;
- self.view.top = 0;
- self.view.height += TOOLBAR_HEIGHT;
-
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ _innerView.top = -STATUS_HEIGHT;
+ self.view.top = 0;
+ self.view.height += TOOLBAR_HEIGHT;
+ }
self.navigationController.navigationBarHidden = YES;
}
@@ -316,7 +324,8 @@ - (void)loadView {
CGRect screenFrame = [UIScreen mainScreen].bounds;
self.view = [[[TTUnclippedView alloc] initWithFrame:screenFrame] autorelease];
- CGRect innerFrame = CGRectMake(0, -CHROME_HEIGHT,
+ CGFloat y = TTOSVersionIsAtLeast(3.0) ? 0 : -CHROME_HEIGHT;
+ CGRect innerFrame = CGRectMake(0, y,
screenFrame.size.width, screenFrame.size.height + CHROME_HEIGHT);
_innerView = [[UIView alloc] initWithFrame:innerFrame];
[self.view addSubview:_innerView];
@@ -352,14 +361,16 @@ - (void)loadView {
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- if (!self.nextViewController) {
- self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
- }
-
- [self hideBarsAnimationDidStop];
- [self showBarsAnimationDidStop];
- if (!_toolbar.alpha) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ if (!self.nextViewController) {
+ self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ }
+
[self hideBarsAnimationDidStop];
+ [self showBarsAnimationDidStop];
+ if (!_toolbar.alpha) {
+ [self hideBarsAnimationDidStop];
+ }
}
}
@@ -368,9 +379,10 @@ - (void)viewWillDisappear:(BOOL)animated {
[self pauseAction];
- self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
- self.view.frame = CGRectOffset(self.view.frame, 0, -TOOLBAR_HEIGHT);
-
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ self.view.frame = CGRectOffset(self.view.frame, 0, -TOOLBAR_HEIGHT);
+ }
if (self.nextViewController) {
[self showBars:YES animated:NO];
}
View
14 src/TTScrollView.m
@@ -102,10 +102,6 @@ - (BOOL)pulled {
return _pageEdges.left > 0 || _pageEdges.top > 0 || _pageEdges.right < 0 || _pageEdges.bottom < 0;
}
-- (BOOL)zoomed {
- return _pageEdges.left != _pageEdges.right || _pageEdges.top != _pageEdges.bottom;
-}
-
- (BOOL)flicked {
if (!self.flipped) {
if (_pageEdges.left > kFlickThreshold && ![self isFirstPage]) {
@@ -996,7 +992,7 @@ - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
} else if (touch.tapCount == 2 && self.canZoom) {
CGPoint pt = [self touchLocation:touch];
if (self.zoomed) {
- [self startAnimationTo:[self reversePageEdges] duration:kFlickDuration];
+ [self zoomToFit];
} else {
[self startAnimationTo:[self zoomPageEdgesTo:pt] duration:kFlickDuration];
}
@@ -1029,6 +1025,10 @@ - (void)deviceOrientationDidChange:(void*)object {
///////////////////////////////////////////////////////////////////////////////////////////////////
+- (BOOL)zoomed {
+ return _pageEdges.left != _pageEdges.right || _pageEdges.top != _pageEdges.bottom;
+}
+
- (void)setDataSource:(id<TTScrollViewDataSource>)dataSource {
_dataSource = dataSource;
[self reloadData];
@@ -1132,4 +1132,8 @@ - (UIView*)pageAtIndex:(NSInteger)pageIndex {
return [self pageAtIndex:pageIndex create:NO];
}
+- (void)zoomToFit {
+ [self startAnimationTo:[self reversePageEdges] duration:kFlickDuration];
+}
+
@end
View
5 src/TTSearchBar.m
@@ -70,8 +70,9 @@ - (void)scrollToTop {
UIScrollView* scrollView = (UIScrollView*)[self firstParentOfClass:[UIScrollView class]];
if (scrollView) {
CGPoint offset = scrollView.contentOffset;
- if (offset.y != self.top) {
- [scrollView setContentOffset:CGPointMake(offset.x, self.top) animated:YES];
+ CGPoint myOffset = [self offsetFromView:scrollView];
+ if (offset.y != myOffset.y) {
+ [scrollView setContentOffset:CGPointMake(offset.x, myOffset.y) animated:YES];
}
}
}
View
26 src/TTSearchTextField.m
@@ -2,6 +2,7 @@
#import "Three20/TTNavigationCenter.h"
#import "Three20/TTView.h"
#import "Three20/TTDefaultStyleSheet.h"
+#import "Three20/TTTableView.h"
#import "Three20/TTTableFieldCell.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -62,10 +63,6 @@ - (void)textFieldDidEndEditing:(UITextField *)textField {
if ([_delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) {
[_delegate textFieldDidEndEditing:textField];
}
-
- if (_textField.dataSource) {
- textField.text = @"";
- }
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range
@@ -103,7 +100,7 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (!_textField.searchesAutomatically) {
[_textField search];
} else {
- [_textField resignFirstResponder];
+ [_textField performSelector:@selector(doneAction)];
}
}
return shouldReturn;
@@ -221,6 +218,7 @@ - (void)autoSearch {
[self search];
}
}
+
- (void)dispatchUpdate:(NSTimer*)timer {
_searchTimer = nil;
[self autoSearch];
@@ -236,6 +234,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 {
@@ -251,6 +250,10 @@ - (void)screenAnimationDidStop {
- (void)doneAction {
[self resignFirstResponder];
+
+ if (self.dataSource) {
+ self.text = @"";
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -362,7 +365,7 @@ - (void)setDataSource:(id<TTTableViewDataSource>)dataSource {
- (UITableView*)tableView {
if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+ _tableView = [[TTTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.backgroundColor = TTSTYLEVAR(searchTableBackgroundColor);
_tableView.separatorColor = TTSTYLEVAR(searchTableSeparatorColor);
_tableView.rowHeight = _rowHeight;
@@ -419,12 +422,11 @@ - (void)showSearchResults:(BOOL)show {
[superview addSubview:_shadowView];
}
}
+
+ [_tableView deselectRowAtIndexPath:_tableView.indexPathForSelectedRow animated:NO];
} else {
- UIView* parent = self.superview;
- if (parent) {
- [_tableView removeFromSuperview];
- [_shadowView removeFromSuperview];
- }
+ [_tableView removeFromSuperview];
+ [_shadowView removeFromSuperview];
}
}
@@ -452,7 +454,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);
View
2  src/TTStyledFrame.m
@@ -158,7 +158,7 @@ - (void)drawInRect:(CGRect)rect {
}
- (TTStyledBoxFrame*)hitTest:(CGPoint)point {
- if (CGRectContainsPoint(CGRectInset(_bounds, 0, -5), point)) {
+ if (CGRectContainsPoint(_bounds, point)) {
TTStyledBoxFrame* frame = [_firstChildFrame hitTest:point];
return frame ? frame : self;
} else if (_nextFrame) {
View
7 src/TTStyledTextLabel.m
@@ -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,
@@ -163,7 +163,8 @@ - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[_highlightedNode performDefaultAction];
[self setHighlightedFrame:nil];
}
-
+ }
+ if (!tableView || TTOSVersionIsAtLeast(3.0)) {
// We definitely don't want to call this if the label is inside a TTTableView, because
// it winds up calling touchesEnded on the table twice, triggering the link twice
[super touchesEnded:touches withEvent:event];
View
1  src/TTStyledTextParser.m
@@ -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];
View
51 src/TTTabBar.m
@@ -302,15 +302,13 @@ - (void)setTabItems:(NSArray*)tabItems {
@implementation TTTabGrid
+@synthesize columnCount = _columnCount;
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// private
-- (NSInteger)columnCount {
- return 3;
-}
-
- (NSInteger)rowCount {
- return ceil((float)self.tabViews.count / [self columnCount]);
+ return ceil((float)self.tabViews.count / self.columnCount);
}
- (void)updateTabStyles {
@@ -318,20 +316,34 @@ - (void)updateTabStyles {
int rowCount = [self rowCount];
int cellCount = rowCount * columnCount;
- int column = 0;
- for (TTTab* tab in self.tabViews) {
- if (column == 0) {
- [tab setStylesWithSelector:@"tabGridTabTopLeft:"];
- } else if (column == columnCount-1) {
- [tab setStylesWithSelector:@"tabGridTabTopRight:"];
- } else if (column == cellCount - columnCount) {
- [tab setStylesWithSelector:@"tabGridTabBottomLeft:"];
- } else if (column == cellCount - 1) {
- [tab setStylesWithSelector:@"tabGridTabBottomRight:"];
- } else {
- [tab setStylesWithSelector:@"tabGridTabCenter:"];
+ if (self.tabViews.count > columnCount) {
+ int column = 0;
+ for (TTTab* tab in self.tabViews) {
+ if (column == 0) {
+ [tab setStylesWithSelector:@"tabGridTabTopLeft:"];
+ } else if (column == columnCount-1) {
+ [tab setStylesWithSelector:@"tabGridTabTopRight:"];
+ } else if (column == cellCount - columnCount) {
+ [tab setStylesWithSelector:@"tabGridTabBottomLeft:"];
+ } else if (column == cellCount - 1) {
+ [tab setStylesWithSelector:@"tabGridTabBottomRight:"];
+ } else {
+ [tab setStylesWithSelector:@"tabGridTabCenter:"];
+ }
+ ++column;
+ }
+ } else {
+ int column = 0;
+ for (TTTab* tab in self.tabViews) {
+ if (column == 0) {
+ [tab setStylesWithSelector:@"tabGridTabLeft:"];
+ } else if (column == columnCount-1) {
+ [tab setStylesWithSelector:@"tabGridTabRight:"];
+ } else {
+ [tab setStylesWithSelector:@"tabGridTabCenter:"];
+ }
+ ++column;
}
- ++column;
}
}
@@ -352,6 +364,7 @@ - (CGSize)layoutTabs {
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.style = TTSTYLE(tabGrid);
+ _columnCount = 3;
}
return self;
}
@@ -386,7 +399,7 @@ @implementation TTTab
- (id)initWithItem:(TTTabItem*)tabItem tabBar:(TTTabBar*)tabBar {
if (self = [self initWithFrame:CGRectZero]) {
_badge = nil;
-
+
self.tabItem = tabItem;
}
return self;
View
11 src/TTTableField.m
@@ -306,26 +306,17 @@ - (void)dealloc {
@implementation TTTextViewTableField
-@synthesize delegate = _delegate, placeholder = _placeholder, text = _text;
-
-- (id)initWithText:(NSString*)text {
- if (self = [self init]) {
- self.text = text;
- }
- return self;
-}
+@synthesize delegate = _delegate, placeholder = _placeholder;
- (id)init {
if (self = [super init]) {
_delegate = nil;
_placeholder = nil;
- _text = nil;
}
return self;
}
- (void)dealloc {
- [_text release];
[_placeholder release];
[super dealloc];
}
View
51 src/TTTableFieldCell.m
@@ -9,6 +9,7 @@
#import "Three20/TTNavigationCenter.h"
#import "Three20/TTURLCache.h"
#import "Three20/TTDefaultStyleSheet.h"
+#import "Three20/TTSearchBar.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -267,6 +268,10 @@ - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*)identifier {
_titleLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
_titleLabel.textAlignment = UITextAlignmentRight;
[self.contentView addSubview:_titleLabel];
+
+ _label.font = TTSTYLEVAR(tableTitleValueFont);
+ _label.adjustsFontSizeToFitWidth = YES;
+ _label.minimumFontSize = 8;
}
return self;
}
@@ -1139,3 +1144,49 @@ - (void)valueChanged {
}
@end
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+@implementation TTSearchBarTableFieldCell
+
++ (CGFloat)tableView:(UITableView*)tableView rowHeightForItem:(id)item {
+ return TOOLBAR_HEIGHT;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*)identifier {
+ if (self = [super initWithFrame:frame reuseIdentifier:identifier]) {
+ _searchBar = nil;
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_searchBar release];
+ [super dealloc];
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+ _searchBar.frame = self.contentView.bounds;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// TTTableViewCell
+
+- (id)object {
+ return _searchBar;
+}
+
+- (void)setObject:(id)object {
+ if (_searchBar != object) {
+ [_searchBar removeFromSuperview];
+ [_searchBar release];
+ _searchBar = [object retain];
+ [self.contentView addSubview:_searchBar];
+ }
+}
+
+@end
+
View
4 src/TTTableView.m
@@ -152,7 +152,7 @@ - (void)showMenu:(UIView*)view forCell:(UITableViewCell*)cell animated:(BOOL)ani
// Move each content subview down, revealing the menu
for (UIView* view in _menuCell.contentView.subviews) {
if (view != _menuView) {
- view.top += _menuCell.contentView.height;
+ view.left -= _menuCell.contentView.width;
}
}
@@ -172,7 +172,7 @@ - (void)hideMenu:(BOOL)animated {
for (UIView* view in _menuCell.contentView.subviews) {
if (view != _menuView) {
- view.top -= _menuCell.contentView.height;
+ view.left += _menuCell.contentView.width;
}
}
View
5 src/TTTableViewDataSource.m
@@ -2,6 +2,7 @@
#import "Three20/TTTableField.h"
#import "Three20/TTTableFieldCell.h"
#import "Three20/TTURLCache.h"
+#import "Three20/TTSearchBar.h"
#import <objc/runtime.h>
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -138,6 +139,8 @@ - (Class)tableView:(UITableView*)tableView cellClassForObject:(id)object {
} else {
return [TTTextTableFieldCell class];
}
+ } else if ([object isKindOfClass:[TTSearchBar class]]) {
+ return [TTSearchBarTableFieldCell class];
}
// This will display an empty white table cell - probably not what you want, but it
@@ -369,7 +372,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- if (_sections) {
+ if (_sections.count) {
NSArray* items = [_items objectAtIndex:section];
return items.count;
} else {
View
1  src/TTThumbsTableViewCell.m
@@ -151,7 +151,6 @@ - (void)setPhoto:(id<TTPhoto>)photo {
_thumbView1.thumbURL = [_photo urlForVersion:TTPhotoVersionThumbnail];
[self assignPhotoAtIndex:_photo.index+1 toView:_thumbView2];
- [self assignPhotoAtIndex:_photo.index+1 toView:_thumbView2];
[self assignPhotoAtIndex:_photo.index+2 toView:_thumbView3];
[self assignPhotoAtIndex:_photo.index+3 toView:_thumbView4];
}
View
25 src/TTThumbsViewController.m
@@ -29,13 +29,15 @@ - (BOOL)hasMoreToLoad {
- (id)initWithController:(TTThumbsViewController*)controller {
if (self = [super init]) {
_controller = controller;
- [_controller.photoSource.delegates addObject:self];
+ _photoSource = [_controller.photoSource retain];
+ [_photoSource.delegates addObject:self];
}
return self;
}
- (void)dealloc {
- [_controller.photoSource.delegates removeObject:self];
+ [_photoSource.delegates removeObject:self];
+ [_photoSource release];
[super dealloc];
}
@@ -192,6 +194,10 @@ - (id)init {
self.navigationBarStyle = UIBarStyleBlackTranslucent;
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
+
+ if ([self respondsToSelector:@selector(setWantsFullScreenLayout:)]) {
+ [self setWantsFullScreenLayout:YES];
+ }
}
return self;
@@ -212,9 +218,10 @@ - (void)loadView {
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- CGRect innerFrame = CGRectMake(0, -CHROME_HEIGHT,
+ CGFloat y = TTOSVersionIsAtLeast(3.0) ? 0 : -CHROME_HEIGHT;
+ CGRect innerFrame = CGRectMake(0, y,
screenFrame.size.width, screenFrame.size.height + CHROME_HEIGHT);
- UIView* innerView = [[UIView alloc] initWithFrame:innerFrame];
+ UIView* innerView = [[[UIView alloc] initWithFrame:innerFrame] autorelease];
innerView.backgroundColor = TTSTYLEVAR(backgroundColor);
[self.view addSubview:innerView];
@@ -236,15 +243,19 @@ - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self suspendLoadingThumbnails:NO];
- if (!self.nextViewController) {
- self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ if (!self.nextViewController) {
+ self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ }
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ if (!TTOSVersionIsAtLeast(3.0)) {
+ self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ }
}
- (void)viewDidDisappear:(BOOL)animated {
View
4 src/TTURLRequest.m
@@ -206,6 +206,10 @@ - (void)cancel {
[[TTURLRequestQueue mainQueue] cancelRequest:self];
}
+- (NSURLRequest*)createNSURLRequest {
+ return [[TTURLRequestQueue mainQueue] createNSURLRequest:self url:nil];
+}
+
@end
//////////////////////////////////////////////////////////////////////////////////////////////////
View
59 src/TTURLRequestQueue.m
@@ -87,31 +87,9 @@ - (void)connectToURL:(NSURL*)url {
TTLOG(@"Connecting to %@", _url);
TTNetworkRequestStarted();
- NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url
- cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
- timeoutInterval:kTimeout];
- [urlRequest setValue:_queue.userAgent forHTTPHeaderField:@"User-Agent"];
+ TTURLRequest* request = _requests.count == 1 ? [_requests objectAtIndex:0] : nil;
+ NSURLRequest *urlRequest = [_queue createNSURLRequest:request url:url];
- if (_requests.count == 1) {
- TTURLRequest* request = [_requests objectAtIndex:0];
- [urlRequest setHTTPShouldHandleCookies:request.shouldHandleCookies];
-
- NSString* method = request.httpMethod;
- if (method) {
- [urlRequest setHTTPMethod:method];
- }
-
- NSString* contentType = request.contentType;
- if (contentType) {
- [urlRequest setValue:contentType forHTTPHeaderField:@"Content-Type"];
- }
-
- NSData* body = request.httpBody;
- if (body) {
- [urlRequest setHTTPBody:body];
- }
- }
-
_connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
}
@@ -263,6 +241,7 @@ - (BOOL)cancel:(TTURLRequest*)request {
if (_connection) {
TTNetworkRequestStopped();
[_connection cancel];
+ [_connection release];
_connection = nil;
}
return NO;
@@ -611,4 +590,36 @@ - (void)cancelAllRequests {
}
}
+- (NSURLRequest*)createNSURLRequest:(TTURLRequest*)request url:(NSURL*)url {
+ if (!url) {
+ url = [NSURL URLWithString:request.url];
+ }
+
+ NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url
+ cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
+ timeoutInterval:kTimeout];
+ [urlRequest setValue:self.userAgent forHTTPHeaderField:@"User-Agent"];
+
+ if (request) {
+ [urlRequest setHTTPShouldHandleCookies:request.shouldHandleCookies];
+
+ NSString* method = request.httpMethod;
+ if (method) {
+ [urlRequest setHTTPMethod:method];
+ }
+
+ NSString* contentType = request.contentType;
+ if (contentType) {
+ [urlRequest setValue:contentType forHTTPHeaderField:@"Content-Type"];
+ }
+
+ NSData* body = request.httpBody;
+ if (body) {
+ [urlRequest setHTTPBody:body];
+ }
+ }
+
+ return urlRequest;
+}
+
@end
View
8 src/TTWebController.m
@@ -169,6 +169,11 @@ - (NSURL*)url {
return _webView.request.URL;
}
+- (void)openRequest:(NSURLRequest*)request {
+ self.view;
+ [_webView loadRequest:request];
+}
+
- (void)setHeaderView:(UIView*)headerView {
if (headerView != _headerView) {
BOOL addingHeader = !_headerView && headerView;
@@ -195,9 +200,8 @@ - (void)setHeaderView:(UIView*)headerView {
}
- (void)openURL:(NSURL*)url {
- self.view;
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url];
- [_webView loadRequest:request];
+ [self openRequest:request];
}
@end
View
14 src/Three20.xcodeproj/project.pbxproj
@@ -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;
};
@@ -767,10 +775,11 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = .;
+ IPHONEOS_DEPLOYMENT_TARGET = 2.2.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PREBINDING = NO;
- SDKROOT = iphonesimulator2.2;
+ SDKROOT = iphoneos3.0;
};
name = Debug;
};
@@ -782,9 +791,10 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 2.2.1;
OTHER_LDFLAGS = "-ObjC";
PREBINDING = NO;
- SDKROOT = iphonesimulator2.2;
+ SDKROOT = iphoneos3.0;
};
name = Release;
};
View
10 src/Three20/NSDateAdditions.h
@@ -0,0 +1,10 @@
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+@interface NSDate (TTCategory)
+
++ (NSDate*)dateWithToday;
+
+- (NSDate*)dateAtMidnight;
+
+@end
View
3  src/Three20/NSStringAdditions.h
@@ -5,9 +5,6 @@
- (BOOL)isWhitespace;
-- (BOOL)beginsWithString:(NSString*)substring;
-- (BOOL)endsWithString:(NSString*)substring;
-
- (NSDictionary*)queryDictionaryUsingEncoding: (NSStringEncoding)encoding;
@end
View
2  src/Three20/TTDefaultStyleSheet.h
@@ -41,6 +41,7 @@
@property(nonatomic,readonly) UIFont* tableFont;
@property(nonatomic,readonly) UIFont* tableSmallFont;
@property(nonatomic,readonly) UIFont* tableTitleFont;
+@property(nonatomic,readonly) UIFont* tableTitleValueFont;
@property(nonatomic,readonly) UIFont* tableButtonFont;
@property(nonatomic,readonly) UIFont* tableSummaryFont;
@property(nonatomic,readonly) UIFont* photoCaptionFont;
@@ -54,4 +55,5 @@
- (TTStyle*)selectionFillStyle:(TTStyle*)next;
+
@end
View
11 src/Three20/TTGlobal.h
@@ -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"
@@ -186,6 +187,16 @@ void TTNetworkRequestStarted();
void TTNetworkRequestStopped();
/**
+ * Gets the current runtime version of iPhone OS.
+ */
+float TTOSVersion();
+
+/**
+ * Checks if the link-time version of the OS is at least a certain version.
+ */
+BOOL TTOSVersionIsAtLeast(float version);
+
+/**
* Gets the current system locale chosen by the user.
*
* This is necessary because [NSLocale currentLocale] always returns en_US.
View
10 src/Three20/TTScrollView.h
@@ -53,6 +53,11 @@
/**
*
*/
+@property(nonatomic,readonly) BOOL zoomed;
+
+/**
+ *
+ */
@property(nonatomic) BOOL scrollEnabled;
/**
@@ -107,6 +112,11 @@
*/
- (UIView*)pageAtIndex:(NSInteger)pageIndex;
+/**
+ *
+ */
+- (void)zoomToFit;
+
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
View
7 src/Three20/TTTabBar.h
@@ -40,7 +40,12 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-@interface TTTabGrid : TTTabBar
+@interface TTTabGrid : TTTabBar {
+ NSInteger _columnCount;
+}
+
+@property(nonatomic) NSInteger columnCount;
+
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
View
2  src/Three20/TTTableField.h
@@ -156,8 +156,6 @@
@property(nonatomic,assign) id<UITextViewDelegate> delegate;
@property(nonatomic,copy) NSString* placeholder;
-- (id)initWithText:(NSString*)text;
-
@end
@interface TTSwitchTableField : TTTableField {
View
8 src/Three20/TTTableFieldCell.h
@@ -1,6 +1,6 @@
#import "Three20/TTTableViewCell.h"
-@class TTTableField, TTImageView, TTErrorView, TTActivityLabel, TTStyledTextLabel;
+@class TTTableField, TTImageView, TTErrorView, TTActivityLabel, TTStyledTextLabel, TTSearchBar;
@interface TTTableFieldCell : TTTableViewCell {
TTTableField* _field;
@@ -80,3 +80,9 @@
}
@end
+
+@interface TTSearchBarTableFieldCell : TTTableViewCell {
+ TTSearchBar* _searchBar;
+}
+
+@end
View
1  src/Three20/TTThumbsViewController.h
@@ -22,6 +22,7 @@
@interface TTThumbsDataSource : TTDataSource
<TTPhotoSourceDelegate, TTThumbsTableViewCellDelegate> {
TTThumbsViewController* _controller;
+ id<TTPhotoSource> _photoSource;
}
- (id)initWithController:(TTThumbsViewController*)controller;
View
2  src/Three20/TTURLRequest.h
@@ -101,6 +101,8 @@
*/
- (void)cancel;
+- (NSURLRequest*)createNSURLRequest;
+
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
View
5 src/Three20/TTURLRequestQueue.h
@@ -76,4 +76,9 @@
*/
- (void)cancelAllRequests;
+/**
+ * Creates a Cocoa URL request from a Three20 URL request.
+ */
+- (NSURLRequest*)createNSURLRequest:(TTURLRequest*)request url:(NSURL*)url;
+
@end
View
1  src/Three20/TTWebController.h
@@ -19,6 +19,7 @@
@property(nonatomic,retain) UIView* headerView;
- (void)openURL:(NSURL*)url;
+- (void)openRequest:(NSURLRequest*)request;
@end
View
7 src/Three20/UIViewAdditions.h
@@ -5,12 +5,15 @@
@property(nonatomic) CGFloat left;
@property(nonatomic) CGFloat top;
-@property(nonatomic,readonly) CGFloat right;
-@property(nonatomic,readonly) CGFloat bottom;
+@property(nonatomic) CGFloat right;
+@property(nonatomic) CGFloat bottom;
@property(nonatomic) CGFloat width;
@property(nonatomic) CGFloat height;
+@property(nonatomic) CGFloat centerX;
+@property(nonatomic) CGFloat centerY;
+
@property(nonatomic,readonly) CGFloat screenX;
@property(nonatomic,readonly) CGFloat screenY;
@property(nonatomic,readonly) CGFloat screenViewX;
View
28 src/UIViewAdditions.m
@@ -112,10 +112,38 @@ - (CGFloat)right {
return self.frame.origin.x + self.frame.size.width;
}
+- (void)setRight:(CGFloat)right {
+ CGRect frame = self.frame;
+ frame.origin.x = right - frame.size.width;
+ self.frame = frame;
+}
+
- (CGFloat)bottom {
return self.frame.origin.y + self.frame.size.height;
}
+- (void)setBottom:(CGFloat)bottom {
+ CGRect frame = self.frame;
+ frame.origin.y = bottom - frame.size.height;
+ self.frame = frame;
+}
+
+- (CGFloat)centerX {
+ return self.center.x;
+}
+
+- (void)setCenterX:(CGFloat)centerX {
+ self.center = CGPointMake(centerX, self.center.y);
+}
+
+- (CGFloat)centerY {
+ return self.center.y;
+}
+
+- (void)setCenterY:(CGFloat)centerY {
+ self.center = CGPointMake(self.center.x, centerY);
+}
+
- (CGFloat)width {
return self.frame.size.width;
}

No commit comments for this range

Something went wrong with that request. Please try again.