adding in popover button and adjusting webview

This commit is contained in:
Roy Yang 2012-06-11 16:56:38 -07:00
parent 8a7fb0966a
commit 9929a9032e
6 changed files with 1221 additions and 47 deletions

View file

@ -22,6 +22,8 @@
UIWindow *window; UIWindow *window;
UISplitViewController *splitStoryController; UISplitViewController *splitStoryController;
UINavigationController *navigationController; UINavigationController *navigationController;
UINavigationController *splitStoryDetailNavigationController;
NewsBlurViewController *feedsViewController; NewsBlurViewController *feedsViewController;
FeedDetailViewController *feedDetailViewController; FeedDetailViewController *feedDetailViewController;
StoryDetailViewController *storyDetailViewController; StoryDetailViewController *storyDetailViewController;
@ -58,6 +60,7 @@
@property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UISplitViewController *splitStoryController; @property (nonatomic, retain) IBOutlet UISplitViewController *splitStoryController;
@property (nonatomic, readonly, retain) IBOutlet UINavigationController *navigationController; @property (nonatomic, readonly, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, readonly, retain) IBOutlet UINavigationController *splitStoryDetailNavigationController;
@property (nonatomic, retain) IBOutlet NewsBlurViewController *feedsViewController; @property (nonatomic, retain) IBOutlet NewsBlurViewController *feedsViewController;
@property (nonatomic, retain) IBOutlet FeedDetailViewController *feedDetailViewController; @property (nonatomic, retain) IBOutlet FeedDetailViewController *feedDetailViewController;
@property (nonatomic, retain) IBOutlet StoryDetailViewController *storyDetailViewController; @property (nonatomic, retain) IBOutlet StoryDetailViewController *storyDetailViewController;
@ -97,6 +100,7 @@
- (void)loadFeedDetailView; - (void)loadFeedDetailView;
- (void)loadRiverFeedDetailView; - (void)loadRiverFeedDetailView;
- (void)loadStoryDetailView; - (void)loadStoryDetailView;
- (void)adjustStoryDetailWebView;
- (void)reloadFeedsView:(BOOL)showLoader; - (void)reloadFeedsView:(BOOL)showLoader;
- (void)hideNavigationBar:(BOOL)animated; - (void)hideNavigationBar:(BOOL)animated;
- (void)showNavigationBar:(BOOL)animated; - (void)showNavigationBar:(BOOL)animated;

View file

@ -25,6 +25,7 @@
@synthesize splitStoryController; @synthesize splitStoryController;
@synthesize navigationController; @synthesize navigationController;
@synthesize splitStoryDetailNavigationController;
@synthesize feedsViewController; @synthesize feedsViewController;
@synthesize feedDetailViewController; @synthesize feedDetailViewController;
@synthesize storyDetailViewController; @synthesize storyDetailViewController;
@ -69,7 +70,10 @@
navigationController.viewControllers = [NSArray arrayWithObject:feedsViewController]; navigationController.viewControllers = [NSArray arrayWithObject:feedsViewController];
[window addSubview:splitStoryController.view]; [window addSubview:splitStoryController.view];
splitStoryController.viewControllers = [NSArray arrayWithObjects:navigationController, detailViewController, nil]; splitStoryDetailNavigationController.viewControllers = [NSArray arrayWithObject:detailViewController];
[window addSubview:splitStoryController.view];
splitStoryController.viewControllers = [NSArray arrayWithObjects:navigationController, splitStoryDetailNavigationController, nil];
[window addSubview:splitStoryController.view]; [window addSubview:splitStoryController.view];
@ -229,12 +233,9 @@
storyDetailViewController.view.tag = 12; storyDetailViewController.view.tag = 12;
[detailViewController.view addSubview:storyDetailViewController.view]; [detailViewController.view addSubview:storyDetailViewController.view];
if (UIInterfaceOrientationIsPortrait(detailViewController.interfaceOrientation)) { [self adjustStoryDetailWebView];
storyDetailViewController.view.frame = CGRectMake(0,0,768,1004);
} else {
storyDetailViewController.view.frame = CGRectMake(0,0,704,748);
}
} else{ } else{
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:feedTitle style: UIBarButtonItemStyleBordered target: nil action: nil]; UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:feedTitle style: UIBarButtonItemStyleBordered target: nil action: nil];
[feedDetailViewController.navigationItem setBackBarButtonItem: newBackButton]; [feedDetailViewController.navigationItem setBackBarButtonItem: newBackButton];
@ -249,6 +250,15 @@
} }
- (void)adjustStoryDetailWebView {
if (UIInterfaceOrientationIsPortrait(detailViewController.interfaceOrientation)) {
storyDetailViewController.view.frame = CGRectMake(0,0,768,960);
} else {
storyDetailViewController.view.frame = CGRectMake(0,0,704,704);
}
}
- (void)navigationController:(UINavigationController *)navController - (void)navigationController:(UINavigationController *)navController
willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (viewController == feedDetailViewController) { if (viewController == feedDetailViewController) {

View file

@ -12,8 +12,10 @@
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate> { @interface DetailViewController : UIViewController <UISplitViewControllerDelegate> {
NewsBlurAppDelegate *appDelegate; NewsBlurAppDelegate *appDelegate;
} }
@property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (strong, nonatomic) UIPopoverController *masterPopoverController; @property (strong, nonatomic) UIPopoverController *masterPopoverController;

View file

@ -10,7 +10,9 @@
#import "NewsBlurAppDelegate.h" #import "NewsBlurAppDelegate.h"
@implementation DetailViewController @implementation DetailViewController
@synthesize masterPopoverController = _masterPopoverController; @synthesize masterPopoverController = _masterPopoverController;
@synthesize appDelegate;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
@ -40,26 +42,14 @@
} }
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// NSArray *subviews = [[self.view subviews] copy]; [appDelegate adjustStoryDetailWebView];
// for (UIView *subview in subviews) {
// if (subview.tag == 12) {
// if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
// NSLog(@"portrait");
// subview.frame = CGRectMake(0,44,768,960);
// } else {
// NSLog(@"landscape");
// subview.frame = CGRectMake(0,44,704,704);
// }
// }
// }
//
} }
#pragma mark - Split view #pragma mark - Split view
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController - (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{ {
// barButtonItem.title = NSLocalizedString(@"Master", @"Master"); barButtonItem.title = NSLocalizedString(@"NewsBlur", @"NewsBlur");
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES]; [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
self.masterPopoverController = popoverController; self.masterPopoverController = popoverController;
} }
@ -67,7 +57,7 @@
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem - (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{ {
// Called when the view is shown again in the split view, invalidating the button and popover controller. // Called when the view is shown again in the split view, invalidating the button and popover controller.
// [self.navigationItem setLeftBarButtonItem:nil animated:YES]; [self.navigationItem setLeftBarButtonItem:nil animated:YES];
self.masterPopoverController = nil; self.masterPopoverController = nil;
} }

View file

@ -121,12 +121,9 @@
<bool key="IBUIHorizontal">NO</bool> <bool key="IBUIHorizontal">NO</bool>
</object> </object>
<object class="IBUIWindow" id="117978783"> <object class="IBUIWindow" id="117978783">
<reference key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">292</int> <int key="NSvFlags">292</int>
<string key="NSFrameSize">{768, 1024}</string> <string key="NSFrameSize">{768, 1024}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<object class="NSColor" key="IBUIBackgroundColor"> <object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int> <int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes> <bytes key="NSRGB">MSAxIDEAA</bytes>
@ -137,6 +134,17 @@
<string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool> <bool key="IBUIResizesToFullScreen">YES</bool>
</object> </object>
<object class="IBUIViewController" id="1023379780">
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
<object class="IBUISplitViewController" id="159036857"> <object class="IBUISplitViewController" id="159036857">
<object class="NSArray" key="IBUIToolbarItems" id="0"> <object class="NSArray" key="IBUIToolbarItems" id="0">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
@ -276,22 +284,6 @@
</object> </object>
<int key="connectionID">127</int> <int key="connectionID">127</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">navigationController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="1024563784"/>
</object>
<int key="connectionID">45</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">detailViewController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="543420271"/>
</object>
<int key="connectionID">142</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection"> <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">splitStoryController</string> <string key="label">splitStoryController</string>
@ -300,6 +292,30 @@
</object> </object>
<int key="connectionID">143</int> <int key="connectionID">143</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">navigationController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="1024563784"/>
</object>
<int key="connectionID">144</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">splitStoryDetailNavigationController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="543420271"/>
</object>
<int key="connectionID">145</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">detailViewController</string>
<reference key="source" ref="664661524"/>
<reference key="destination" ref="1023379780"/>
</object>
<int key="connectionID">148</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection"> <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">appDelegate</string> <string key="label">appDelegate</string>
@ -356,6 +372,14 @@
</object> </object>
<int key="connectionID">125</int> <int key="connectionID">125</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">appDelegate</string>
<reference key="source" ref="1023379780"/>
<reference key="destination" ref="664661524"/>
</object>
<int key="connectionID">149</int>
</object>
</object> </object>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
@ -473,6 +497,11 @@
<reference key="object" ref="451803536"/> <reference key="object" ref="451803536"/>
<reference key="parent" ref="121528350"/> <reference key="parent" ref="121528350"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">146</int>
<reference key="object" ref="1023379780"/>
<reference key="parent" ref="0"/>
</object>
</object> </object>
</object> </object>
<object class="NSMutableDictionary" key="flattenedProperties"> <object class="NSMutableDictionary" key="flattenedProperties">
@ -503,6 +532,8 @@
<string>135.IBPluginDependency</string> <string>135.IBPluginDependency</string>
<string>136.CustomClassName</string> <string>136.CustomClassName</string>
<string>136.IBPluginDependency</string> <string>136.IBPluginDependency</string>
<string>146.CustomClassName</string>
<string>146.IBPluginDependency</string>
<string>3.CustomClassName</string> <string>3.CustomClassName</string>
<string>3.IBPluginDependency</string> <string>3.IBPluginDependency</string>
<string>39.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string> <string>39.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string>
@ -560,6 +591,8 @@
</object> </object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UINavigationController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>DetailViewController</string> <string>DetailViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>NewsBlurAppDelegate</string> <string>NewsBlurAppDelegate</string>
@ -599,7 +632,7 @@
<reference key="dict.values" ref="0"/> <reference key="dict.values" ref="0"/>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">143</int> <int key="maxID">149</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -806,6 +839,17 @@
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">DetailViewController</string> <string key="className">DetailViewController</string>
<string key="superclassName">UIViewController</string> <string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">appDelegate</string>
<string key="NS.object.0">NewsBlurAppDelegate</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">appDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier"> <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string> <string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/DetailViewController.h</string> <string key="minorKey">./Classes/DetailViewController.h</string>
@ -1218,6 +1262,7 @@
<string>navigationController</string> <string>navigationController</string>
<string>originalStoryViewController</string> <string>originalStoryViewController</string>
<string>splitStoryController</string> <string>splitStoryController</string>
<string>splitStoryDetailNavigationController</string>
<string>storyDetailViewController</string> <string>storyDetailViewController</string>
<string>window</string> <string>window</string>
</object> </object>
@ -1232,6 +1277,7 @@
<string>UINavigationController</string> <string>UINavigationController</string>
<string>OriginalStoryViewController</string> <string>OriginalStoryViewController</string>
<string>UISplitViewController</string> <string>UISplitViewController</string>
<string>UINavigationController</string>
<string>StoryDetailViewController</string> <string>StoryDetailViewController</string>
<string>UIWindow</string> <string>UIWindow</string>
</object> </object>
@ -1249,6 +1295,7 @@
<string>navigationController</string> <string>navigationController</string>
<string>originalStoryViewController</string> <string>originalStoryViewController</string>
<string>splitStoryController</string> <string>splitStoryController</string>
<string>splitStoryDetailNavigationController</string>
<string>storyDetailViewController</string> <string>storyDetailViewController</string>
<string>window</string> <string>window</string>
</object> </object>
@ -1290,6 +1337,10 @@
<string key="name">splitStoryController</string> <string key="name">splitStoryController</string>
<string key="candidateClassName">UISplitViewController</string> <string key="candidateClassName">UISplitViewController</string>
</object> </object>
<object class="IBToOneOutletInfo">
<string key="name">splitStoryDetailNavigationController</string>
<string key="candidateClassName">UINavigationController</string>
</object>
<object class="IBToOneOutletInfo"> <object class="IBToOneOutletInfo">
<string key="name">storyDetailViewController</string> <string key="name">storyDetailViewController</string>
<string key="candidateClassName">StoryDetailViewController</string> <string key="candidateClassName">StoryDetailViewController</string>