Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Fix the photo viewer and message composer is iPhone OS 3.0

  • Loading branch information...
commit d77ad02d462e0035e039827c7b035e6688d57c8e 1 parent 57bd904
@joehewitt joehewitt authored
View
2  README.mdown
@@ -46,7 +46,7 @@ Three20 is compiled as a static library, and the easiest way to add it to your p
it. Add the relative path from your project's directory to the "three20/src" directory.
8. While you are in Project Settings, go to "Other Linker Flags" under the "Linker" section, and
- add "-ObjC" to the list of flags.
+ 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.
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
4 src/NSDateAdditions.m
@@ -8,7 +8,11 @@ + (id)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;
}
View
4 src/TTGlobal.m
@@ -89,6 +89,10 @@ void TTNetworkRequestStopped() {
}
}
+float TTOSVersion() {
+ return [[[UIDevice currentDevice] systemVersion] floatValue];
+}
+
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 (TTOSVersion() >= 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
48 src/TTPhotoViewController.m
@@ -42,6 +42,10 @@ - (id)init {
self.navigationBarStyle = UIBarStyleBlackTranslucent;
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
+
+ if (TTOSVersion() >= 3.0) {
+ [self setWantsFullScreenLayout:YES];
+ }
}
return self;
}
@@ -294,18 +298,20 @@ - (void)previousAction {
}
- (void)showBarsAnimationDidStop {
- _innerView.top = -CHROME_HEIGHT;
- self.view.top = TOOLBAR_HEIGHT;
- self.view.height -= TOOLBAR_HEIGHT;
-
+ if (TTOSVersion() < 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 (TTOSVersion() < 3.0) {
+ _innerView.top = -STATUS_HEIGHT;
+ self.view.top = 0;
+ self.view.height += TOOLBAR_HEIGHT;
+ }
self.navigationController.navigationBarHidden = YES;
}
@@ -316,7 +322,8 @@ - (void)loadView {
CGRect screenFrame = [UIScreen mainScreen].bounds;
self.view = [[[TTUnclippedView alloc] initWithFrame:screenFrame] autorelease];
- CGRect innerFrame = CGRectMake(0, -CHROME_HEIGHT,
+ CGFloat y = TTOSVersion() < 3.0 ? -CHROME_HEIGHT : 0;
+ CGRect innerFrame = CGRectMake(0, y,
screenFrame.size.width, screenFrame.size.height + CHROME_HEIGHT);
_innerView = [[UIView alloc] initWithFrame:innerFrame];
[self.view addSubview:_innerView];
@@ -352,14 +359,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 (TTOSVersion() < 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 +377,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 (TTOSVersion() < 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
3  src/TTStyledTextLabel.m
@@ -163,7 +163,8 @@ - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[_highlightedNode performDefaultAction];
[self setHighlightedFrame:nil];
}
-
+ }
+ if (!tableView || TTOSVersion() >= 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
17 src/TTThumbsViewController.m
@@ -194,6 +194,10 @@ - (id)init {
self.navigationBarStyle = UIBarStyleBlackTranslucent;
self.navigationBarTintColor = nil;
self.statusBarStyle = UIStatusBarStyleBlackTranslucent;
+
+ if (TTOSVersion() >= 3.0) {
+ [self setWantsFullScreenLayout:YES];
+ }
}
return self;
@@ -214,7 +218,8 @@ - (void)loadView {
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- CGRect innerFrame = CGRectMake(0, -CHROME_HEIGHT,
+ CGFloat y = TTOSVersion() < 3.0 ? -CHROME_HEIGHT : 0;
+ CGRect innerFrame = CGRectMake(0, y,
screenFrame.size.width, screenFrame.size.height + CHROME_HEIGHT);
UIView* innerView = [[UIView alloc] initWithFrame:innerFrame];
innerView.backgroundColor = TTSTYLEVAR(backgroundColor);
@@ -238,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 (TTOSVersion() < 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 (TTOSVersion() < 3.0) {
+ self.view.superview.frame = CGRectOffset(self.view.superview.frame, 0, TOOLBAR_HEIGHT);
+ }
}
- (void)viewDidDisappear:(BOOL)animated {
View
5 src/Three20/TTGlobal.h
@@ -187,6 +187,11 @@ void TTNetworkRequestStarted();
void TTNetworkRequestStopped();
/**
+ * Gets the current version of iPhone OS.
+ */
+float TTOSVersion();
+
+/**
* Gets the current system locale chosen by the user.
*
* This is necessary because [NSLocale currentLocale] always returns en_US.
Please sign in to comment.
Something went wrong with that request. Please try again.