mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
adding in popover and moving hide logic for story detail view
This commit is contained in:
parent
b954441caa
commit
8a7fb0966a
7 changed files with 72 additions and 52 deletions
|
@ -132,20 +132,6 @@
|
|||
[super viewDidAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
|
||||
NSArray *subviews = [[appDelegate.detailViewController.view subviews] copy];
|
||||
for (UIView *subview in subviews) {
|
||||
if (subview.tag == 12) {
|
||||
[subview removeFromSuperview];
|
||||
}
|
||||
}
|
||||
[subviews release];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[storyTitlesTable release];
|
||||
[feedViewToolbar release];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
@interface NewsBlurAppDelegate : BaseViewController <UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
UISplitViewController *splitViewController;
|
||||
UISplitViewController *splitStoryController;
|
||||
UINavigationController *navigationController;
|
||||
NewsBlurViewController *feedsViewController;
|
||||
FeedDetailViewController *feedDetailViewController;
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIWindow *window;
|
||||
@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
|
||||
@property (nonatomic, retain) IBOutlet UISplitViewController *splitStoryController;
|
||||
@property (nonatomic, readonly, retain) IBOutlet UINavigationController *navigationController;
|
||||
@property (nonatomic, retain) IBOutlet NewsBlurViewController *feedsViewController;
|
||||
@property (nonatomic, retain) IBOutlet FeedDetailViewController *feedDetailViewController;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
@synthesize window;
|
||||
|
||||
@synthesize splitViewController;
|
||||
@synthesize splitStoryController;
|
||||
@synthesize navigationController;
|
||||
@synthesize feedsViewController;
|
||||
@synthesize feedDetailViewController;
|
||||
|
@ -67,11 +67,14 @@
|
|||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
|
||||
navigationController.viewControllers = [NSArray arrayWithObject:feedsViewController];
|
||||
[window addSubview:splitViewController.view];
|
||||
[window addSubview:splitStoryController.view];
|
||||
|
||||
splitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, detailViewController, nil];
|
||||
splitStoryController.viewControllers = [NSArray arrayWithObjects:navigationController, detailViewController, nil];
|
||||
|
||||
[window addSubview:splitViewController.view];
|
||||
[window addSubview:splitStoryController.view];
|
||||
|
||||
splitStoryController.delegate = (id)detailViewController;
|
||||
self.window.rootViewController = self.splitViewController;
|
||||
|
||||
|
||||
} else {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import "NewsBlurViewController.h"
|
||||
#import "NewsBlurAppDelegate.h"
|
||||
#import "DetailViewController.h"
|
||||
#import "FeedTableCell.h"
|
||||
#import "ASIHTTPRequest.h"
|
||||
#import "PullToRefreshView.h"
|
||||
|
@ -105,6 +106,20 @@
|
|||
|
||||
[self.feedTitlesTable selectRowAtIndexPath:[feedTitlesTable indexPathForSelectedRow]
|
||||
animated:YES scrollPosition:UITableViewScrollPositionMiddle];
|
||||
|
||||
|
||||
// remove the right detail view in storySplitController
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
|
||||
NSArray *subviews = [[appDelegate.detailViewController.view subviews] copy];
|
||||
for (UIView *subview in subviews) {
|
||||
if (subview.tag == 12) {
|
||||
[subview removeFromSuperview];
|
||||
}
|
||||
}
|
||||
[subviews release];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
|
|
|
@ -10,8 +10,11 @@
|
|||
|
||||
@class NewsBlurAppDelegate;
|
||||
|
||||
@interface DetailViewController : UIViewController {
|
||||
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate> {
|
||||
NewsBlurAppDelegate *appDelegate;
|
||||
}
|
||||
|
||||
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,11 +9,8 @@
|
|||
#import "DetailViewController.h"
|
||||
#import "NewsBlurAppDelegate.h"
|
||||
|
||||
@interface DetailViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation DetailViewController
|
||||
@synthesize masterPopoverController = _masterPopoverController;
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
|
@ -43,20 +40,35 @@
|
|||
}
|
||||
|
||||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
NSArray *subviews = [[self.view subviews] copy];
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NSArray *subviews = [[self.view subviews] copy];
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
@end
|
||||
#pragma mark - Split view
|
||||
|
||||
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
|
||||
{
|
||||
// barButtonItem.title = NSLocalizedString(@"Master", @"Master");
|
||||
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
|
||||
self.masterPopoverController = popoverController;
|
||||
}
|
||||
|
||||
- (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.
|
||||
// [self.navigationItem setLeftBarButtonItem:nil animated:YES];
|
||||
self.masterPopoverController = nil;
|
||||
}
|
||||
|
||||
@end
|
|
@ -126,6 +126,7 @@
|
|||
<string key="NSFrameSize">{768, 1024}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MSAxIDEAA</bytes>
|
||||
|
@ -283,14 +284,6 @@
|
|||
</object>
|
||||
<int key="connectionID">45</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">splitViewController</string>
|
||||
<reference key="source" ref="664661524"/>
|
||||
<reference key="destination" ref="159036857"/>
|
||||
</object>
|
||||
<int key="connectionID">141</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">detailViewController</string>
|
||||
|
@ -299,6 +292,14 @@
|
|||
</object>
|
||||
<int key="connectionID">142</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">splitStoryController</string>
|
||||
<reference key="source" ref="664661524"/>
|
||||
<reference key="destination" ref="159036857"/>
|
||||
</object>
|
||||
<int key="connectionID">143</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">appDelegate</string>
|
||||
|
@ -598,7 +599,7 @@
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">142</int>
|
||||
<int key="maxID">143</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -1216,7 +1217,7 @@
|
|||
<string>moveSiteViewController</string>
|
||||
<string>navigationController</string>
|
||||
<string>originalStoryViewController</string>
|
||||
<string>splitViewController</string>
|
||||
<string>splitStoryController</string>
|
||||
<string>storyDetailViewController</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
|
@ -1247,7 +1248,7 @@
|
|||
<string>moveSiteViewController</string>
|
||||
<string>navigationController</string>
|
||||
<string>originalStoryViewController</string>
|
||||
<string>splitViewController</string>
|
||||
<string>splitStoryController</string>
|
||||
<string>storyDetailViewController</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
|
@ -1286,7 +1287,7 @@
|
|||
<string key="candidateClassName">OriginalStoryViewController</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">splitViewController</string>
|
||||
<string key="name">splitStoryController</string>
|
||||
<string key="candidateClassName">UISplitViewController</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
|
|
Loading…
Add table
Reference in a new issue