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: othermedia/three20
base: master
...
head fork: jdelStrother/three20
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 28 files changed
  • 0 commit comments
  • 2 contributors
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
View
15 src/NSDateAdditions.m
@@ -4,15 +4,20 @@
@implementation NSDate (TTCategory)
-+ (id)dateWithToday {
++ (NSDate*)dateWithToday {
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
formatter.dateFormat = @"yyyy-d-M";
-#ifdef JOE
- NSString* time = [formatter stringFromDate:[NSDate dateWithTimeIntervalSinceNow:-(60*60*24*14)]];
-# else
NSString* time = [formatter stringFromDate:[NSDate date]];
-#endif
+ 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;
}
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
16 src/TTGlobal.m
@@ -93,6 +93,22 @@ 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
2  src/TTMessageController.m
@@ -326,7 +326,7 @@ - (void)loadView {
CGRect innerFrame = CGRectMake(0, TOOLBAR_HEIGHT,
appFrame.size.width, appFrame.size.height - (TOOLBAR_HEIGHT+KEYBOARD_HEIGHT));
- if (TTOSVersion() >= 3.0) {
+ if (TTOSVersionIsAtLeast(3.0)) {
_scrollView = [[[UIScrollView class] alloc] initWithFrame:innerFrame];
} else {
_scrollView = [[[TTComposeInnerScrollView class] alloc] initWithFrame:innerFrame];
View
12 src/TTPhotoViewController.m
@@ -44,7 +44,7 @@ - (id)init {
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
- if (TTOSVersion() >= 3.0) {
+ if ([self respondsToSelector:@selector(setWantsFullScreenLayout:)]) {
[self setWantsFullScreenLayout:YES];
}
}
@@ -300,7 +300,7 @@ - (void)previousAction {
}
- (void)showBarsAnimationDidStop {
- if (TTOSVersion() < 3.0) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
_innerView.top = -CHROME_HEIGHT;
self.view.top = TOOLBAR_HEIGHT;
self.view.height -= TOOLBAR_HEIGHT;
@@ -309,7 +309,7 @@ - (void)showBarsAnimationDidStop {
}
- (void)hideBarsAnimationDidStop {
- if (TTOSVersion() < 3.0) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
_innerView.top = -STATUS_HEIGHT;
self.view.top = 0;
self.view.height += TOOLBAR_HEIGHT;
@@ -324,7 +324,7 @@ - (void)loadView {
CGRect screenFrame = [UIScreen mainScreen].bounds;
self.view = [[[TTUnclippedView alloc] initWithFrame:screenFrame] autorelease];
- CGFloat y = TTOSVersion() < 3.0 ? -CHROME_HEIGHT : 0;
+ 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];
@@ -361,7 +361,7 @@ - (void)loadView {
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- if (TTOSVersion() < 3.0) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
if (!self.nextViewController) {
self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
}
@@ -379,7 +379,7 @@ - (void)viewWillDisappear:(BOOL)animated {
[self pauseAction];
- if (TTOSVersion() < 3.0) {
+ 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);
}
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
11 src/TTSearchTextField.m
@@ -63,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
@@ -104,7 +100,7 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (!_textField.searchesAutomatically) {
[_textField search];
} else {
- [_textField resignFirstResponder];
+ [_textField performSelector:@selector(doneAction)];
}
}
return shouldReturn;
@@ -222,6 +218,7 @@ - (void)autoSearch {
[self search];
}
}
+
- (void)dispatchUpdate:(NSTimer*)timer {
_searchTimer = nil;
[self autoSearch];
@@ -253,6 +250,10 @@ - (void)screenAnimationDidStop {
- (void)doneAction {
[self resignFirstResponder];
+
+ if (self.dataSource) {
+ self.text = @"";
+ }
}
///////////////////////////////////////////////////////////////////////////////////////////////////
View
2  src/TTStyledTextLabel.m
@@ -164,7 +164,7 @@ - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[self setHighlightedFrame:nil];
}
}
- if (!tableView || TTOSVersion() >= 3.0) {
+ 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
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
9 src/TTTableField.m
@@ -308,24 +308,15 @@ @implementation TTTextViewTableField
@synthesize delegate = _delegate, placeholder = _placeholder;
-- (id)initWithText:(NSString*)text {
- if (self = [self init]) {
- self.text = text;
- }
- return self;
-}
-
- (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
3  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
View
10 src/TTThumbsViewController.m
@@ -195,7 +195,7 @@ - (id)init {
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
- if (TTOSVersion() >= 3.0) {
+ if ([self respondsToSelector:@selector(setWantsFullScreenLayout:)]) {
[self setWantsFullScreenLayout:YES];
}
}
@@ -218,10 +218,10 @@ - (void)loadView {
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- CGFloat y = TTOSVersion() < 3.0 ? -CHROME_HEIGHT : 0;
+ 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];
@@ -243,7 +243,7 @@ - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self suspendLoadingThumbnails:NO];
- if (TTOSVersion() < 3.0) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
if (!self.nextViewController) {
self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
}
@@ -253,7 +253,7 @@ - (void)viewDidAppear:(BOOL)animated {
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- if (TTOSVersion() < 3.0) {
+ if (!TTOSVersionIsAtLeast(3.0)) {
self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
}
}
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
6 src/Three20.xcodeproj/project.pbxproj
@@ -775,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;
};
@@ -790,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
4 src/Three20/NSDateAdditions.h
@@ -3,6 +3,8 @@
@interface NSDate (TTCategory)
-+ (id)dateWithToday;
++ (NSDate*)dateWithToday;
+
+- (NSDate*)dateAtMidnight;
@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
7 src/Three20/TTGlobal.h
@@ -187,11 +187,16 @@ void TTNetworkRequestStarted();
void TTNetworkRequestStopped();
/**
- * Gets the current version of iPhone OS.
+ * 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
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

No commit comments for this range

Something went wrong with that request. Please try again.