Permalink
Browse files

New launch graphics, minor tweaks

  • Loading branch information...
1 parent 2241450 commit 340c5f1ea2e1866e5e8a464efb689f1644308c3a @dmpatierno dmpatierno committed Nov 24, 2011
@@ -382,6 +382,9 @@ - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath
[self.view endEditing:YES];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
+ if (searching && ![searchResults count])
+ return;
+
int base = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad &&
![self.title isEqual:@"Categories"] ? 0 : 1;
View
@@ -93,7 +93,8 @@ - (void)setSite:(NSInteger)theSite {
default:
self.backgroundColor = [UIColor blackColor];
self.textColor = [UIColor whiteColor];
- self.toolbarColor = [UIColor darkGrayColor];
+ //self.toolbarColor = [UIColor darkGrayColor];
+ self.toolbarColor = [UIColor colorWithRed:.19 green:.21 blue:.23 alpha:1.0];
// Load intro and step css from the css folder.
self.introCSS = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ifixit_intro" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
@@ -12,5 +12,6 @@
@property (nonatomic, retain) NSNumberFormatter *formatter;
@property (nonatomic, retain) NSURL *externalURL;
@property (nonatomic, assign) UIViewController *modalDelegate;
+@property (nonatomic) BOOL linksOpenInSameWindow;
@end
@@ -15,7 +15,7 @@
@implementation GuideCatchingWebView
-@synthesize externalDelegate, externalURL, formatter, modalDelegate;
+@synthesize externalDelegate, externalURL, formatter, modalDelegate, linksOpenInSameWindow;
- (id)initWithCoder:(NSCoder *)aDecoder {
if ((self = [super initWithCoder:aDecoder])) {
@@ -85,43 +85,20 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
shouldStart = [externalDelegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
if (shouldStart) {
- // Open all other URLs with Safari.
- NSString *host = [[request URL] host];
- if (![host isEqual:[Config host]] && navigationType == UIWebViewNavigationTypeLinkClicked) {
+ if (linksOpenInSameWindow)
+ return YES;
+
+ // Open all other URLs with modal view.
+ if (navigationType == UIWebViewNavigationTypeLinkClicked) {
SVWebViewController *webViewController = [[SVWebViewController alloc] initWithAddress:[[request URL] absoluteString]];
if (!modalDelegate)
[delegate.window.rootViewController presentModalViewController:webViewController animated:YES];
else
[modalDelegate presentModalViewController:webViewController animated:YES];
[webViewController release];
- }
- }
-
- // Add custom headers if needed, and restart the request.
- /*
- if ([host isEqual:[Config host]]) {
- NSDictionary *headers = [request allHTTPHeaderFields];
- BOOL hasCustomHeader = NO;
- for (NSString *key in [headers allKeys]) {
- if ([key isEqualToString:@"Mobile-Client"]) {
- hasCustomHeader = YES;
- break;
- }
- }
-
- if (!hasCustomHeader) {
- NSString *device = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ?
- @"Wide iFixit" : @"Thin iFixit";
- NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
- NSString *mobileClient = [NSString stringWithFormat:@"%@ %@", device, version];
-
- NSMutableURLRequest *newRequest = [request mutableCopy];
- [newRequest setValue:mobileClient forHTTPHeaderField:@"Mobile-Client"];
- [webView loadRequest:newRequest];
return NO;
}
}
- */
return shouldStart;
}
View
@@ -46,7 +46,7 @@
<string key="NSFrameSize">{320, 372}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="650426670"/>
+ <reference key="NSNextKeyView" ref="550669568"/>
<string key="NSReuseIdentifierKey">_NS:569</string>
<float key="IBUIAlpha">0.40000000596046448</float>
<int key="IBUIContentMode">2</int>
@@ -59,7 +59,7 @@
<string key="NSFrameSize">{320, 372}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="650426670"/>
<string key="NSReuseIdentifierKey">_NS:212</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">2</int>
@@ -133,6 +133,14 @@
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">overlayView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="550669568"/>
+ </object>
+ <int key="connectionID">15</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="650426670"/>
<reference key="destination" ref="372490531"/>
@@ -204,6 +212,7 @@
<string>1.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>13.IBPluginDependency</string>
+ <string>3.CustomClassName</string>
<string>3.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -215,6 +224,7 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>GuideCatchingWebView</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
@@ -230,12 +240,20 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">14</int>
+ <int key="maxID">15</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">GuideCatchingWebView</string>
+ <string key="superclassName">UIWebView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/GuideCatchingWebView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">GuideIntroViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
@@ -246,6 +264,7 @@
<string>headerImageIFixit</string>
<string>headerImageMake</string>
<string>mainImage</string>
+ <string>overlayView</string>
<string>swipeLabel</string>
<string>webView</string>
</object>
@@ -255,8 +274,9 @@
<string>UIImageView</string>
<string>UIImageView</string>
<string>UIImageView</string>
+ <string>UIView</string>
<string>UILabel</string>
- <string>UIWebView</string>
+ <string>GuideCatchingWebView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -267,6 +287,7 @@
<string>headerImageIFixit</string>
<string>headerImageMake</string>
<string>mainImage</string>
+ <string>overlayView</string>
<string>swipeLabel</string>
<string>webView</string>
</object>
@@ -289,12 +310,16 @@
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">overlayView</string>
+ <string key="candidateClassName">UIView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">swipeLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">webView</string>
- <string key="candidateClassName">UIWebView</string>
+ <string key="candidateClassName">GuideCatchingWebView</string>
</object>
</object>
</object>
@@ -7,18 +7,21 @@
//
@class Guide;
+@class GuideCatchingWebView;
@interface GuideIntroViewController : UIViewController <UIWebViewDelegate>
@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) IBOutlet UIImageView *headerImageIFixit;
@property (nonatomic, retain) IBOutlet UIImageView *headerImageMake;
-@property (nonatomic, retain) IBOutlet UILabel *swipeLabel;
+@property (retain, nonatomic) IBOutlet UILabel *headerTextDozuki;
+@property (nonatomic, retain) IBOutlet UIImageView *swipeLabel;
+@property (retain, nonatomic) IBOutlet UIView *overlayView;
@property (nonatomic, retain) Guide *guide;
@property (nonatomic, retain) IBOutlet UILabel *device;
@property (nonatomic, retain) IBOutlet UIImageView *mainImage;
-@property (nonatomic, retain) IBOutlet UIWebView *webView;
+@property (nonatomic, retain) IBOutlet GuideCatchingWebView *webView;
@property (nonatomic, retain) UIImage *huge;
@property (nonatomic, retain) NSString *html;
@@ -7,15 +7,18 @@
//
#import "GuideIntroViewController.h"
+#import "GuideCatchingWebView.h"
#import "Guide.h"
#import "UIImageView+WebCache.h"
#import "Config.h"
#import "SVWebViewController.h"
#import <QuartzCore/QuartzCore.h>
@implementation GuideIntroViewController
+@synthesize headerTextDozuki;
@synthesize delegate, headerImageIFixit, headerImageMake, swipeLabel;
+@synthesize overlayView;
@synthesize guide=_guide;
@synthesize device, mainImage, webView, huge, html;
@@ -56,24 +59,19 @@ - (void)addViewShadow:(UIView *)view {
- (void)viewDidLoad {
[super viewDidLoad];
-
- swipeLabel.font = [UIFont fontWithName:@"Ubuntu-BoldItalic" size:48.0];
// Set the appropriate header image.
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
if ([Config currentConfig].site == ConfigMake || [Config currentConfig].site == ConfigMakeDev) {
headerImageMake.hidden = NO;
- swipeLabel.textColor = [UIColor redColor];
}
else if ([Config currentConfig].site == ConfigIFixit || [Config currentConfig].site == ConfigIFixitDev) {
headerImageIFixit.hidden = NO;
}
- // If this is a Dozuki site, we have no logo, so move the intro up to fill the space.
else {
- CGRect frame = self.webView.frame;
- frame.origin.y -= 80.0;
- frame.size.height += 80.0;
- self.webView.frame = frame;
+ headerTextDozuki.font = [UIFont fontWithName:@"Lobster" size:75.0];
+ headerTextDozuki.text = [[Config currentConfig].siteData valueForKey:@"title"];
+ headerTextDozuki.hidden = NO;
}
}
@@ -82,15 +80,21 @@ - (void)viewDidLoad {
swipeLabel.hidden = YES;
UIColor *bgColor = [UIColor clearColor];
+
+ if ([[Config currentConfig].backgroundColor isEqual:[UIColor whiteColor]]) {
+ overlayView.backgroundColor = [UIColor whiteColor];
+ overlayView.alpha = 0.3;
+ }
self.view.backgroundColor = bgColor;
+ webView.modalDelegate = delegate;
webView.backgroundColor = bgColor;
webView.opaque = NO;
// Load the intro contents as HTML.
NSString *header = [NSString stringWithFormat:@"<html><head><style type=\"text/css\"> %@ </style></head><body class=\"%@\">",
[Config currentConfig].introCSS,
- (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? @"big" : @"small"];
+ ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ? @"big" : @"small"];
NSString *footer = @"</body></html>";
NSString *body = self.guide.introduction_rendered;
@@ -109,18 +113,6 @@ - (void)viewDidLoad {
[mainImage setImageWithURL:[self.guide.image URLForSize:@"standard"] placeholderImage:nil];
}
-- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
- if (navigationType != UIWebViewNavigationTypeLinkClicked)
- return YES;
-
- // Load all URLs in popup browser.
- SVWebViewController *webViewController = [[SVWebViewController alloc] initWithAddress:[[request URL] absoluteString]];
- [self.delegate presentModalViewController:webViewController animated:YES];
- [webViewController release];
-
- return NO;
-}
-
// Because the web view has a white background, it starts hidden.
// After the content is loaded, we wait a small amount of time before showing it to prevent flicker.
- (void)webViewDidFinishLoad:(UIWebView *)webView {
@@ -144,8 +136,8 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (void)layoutLandscape {
// iPad
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
- swipeLabel.frame = CGRectMake(617.0, 588.0, 387.0, 65.0);
- webView.frame = CGRectMake(20.0, 160.0, 984.0, 420.0);
+ swipeLabel.frame = CGRectMake(600.0, 563.0, 375.0, 84.0);
+ webView.frame = CGRectMake(20.0, 160.0, 984.0, 395.0);
}
// iPhone
else {
@@ -157,8 +149,8 @@ - (void)layoutLandscape {
- (void)layoutPortrait {
// iPad
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
- swipeLabel.frame = CGRectMake(360.0, 800.0, 387.0, 65.0);
- webView.frame = CGRectMake(20.0, 160.0, 728.0, 640.0);
+ swipeLabel.frame = CGRectMake(340.0, 790.0, 375.0, 84.0);
+ webView.frame = CGRectMake(20.0, 160.0, 728.0, 605.0);
}
// iPhone
else {
@@ -189,6 +181,8 @@ - (void)didReceiveMemoryWarning {
- (void)viewDidUnload {
+ [self setOverlayView:nil];
+ [self setHeaderTextDozuki:nil];
[super viewDidUnload];
self.headerImageIFixit = nil;
self.headerImageMake = nil;
@@ -215,6 +209,8 @@ - (void)dealloc {
[mainImage release];
[webView release];
+ [overlayView release];
+ [headerTextDozuki release];
[super dealloc];
}
Oops, something went wrong.

0 comments on commit 340c5f1

Please sign in to comment.