Fixing all issues with ipad traversal. Now to go back to the iphone.

This commit is contained in:
Samuel Clay 2012-11-08 18:30:45 -08:00
parent 845b78475a
commit 7b8a420def
5 changed files with 41 additions and 11 deletions

View file

@ -159,9 +159,7 @@
- (void)viewDidAppear:(BOOL)animated {
if (appDelegate.inStoryDetail && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
appDelegate.inStoryDetail = NO;
[appDelegate.storyPageControl.currentPage clearStory];
[appDelegate.storyPageControl.nextPage clearStory];
[appDelegate.storyDetailViewController clearStory];
[appDelegate.storyPageControl resetPages];
[self checkScroll];
}
}

View file

@ -540,7 +540,7 @@
[self transitionFromShareView];
}
[self.storyPageControl clearStory];
[self.storyPageControl resetPages];
self.feedDetailIsVisible = NO;
CGRect vb = [self.view bounds];

View file

@ -30,6 +30,8 @@
WEPopoverController *popoverController;
Class popoverClass;
BOOL isDraggingScrollview;
}
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
@ -53,6 +55,7 @@
@property (nonatomic) IBOutlet UIBarButtonItem *originalStoryButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *subscribeButton;
@property (readwrite) CGFloat inTouchMove;
@property (assign) BOOL isDraggingScrollview;
@property (nonatomic, strong) WEPopoverController *popoverController;
@ -60,7 +63,7 @@
- (void)applyNewIndex:(NSInteger)newIndex pageController:(StoryDetailViewController *)pageController;
- (void)transitionFromFeedDetail;
- (void)clearStory;
- (void)resetPages;
- (void)setStoryFromScroll;
- (void)updatePageWithActiveStory:(int)location;
- (void)changePage:(NSInteger)pageIndex;

View file

@ -44,6 +44,7 @@
@synthesize popoverController;
@synthesize loadingIndicator;
@synthesize inTouchMove;
@synthesize isDraggingScrollview;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
@ -127,11 +128,14 @@
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
self.bottomPlaceholderToolbar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
}
[self.scrollView addObserver:self forKeyPath:@"contentOffset"
options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
context:nil];
}
- (void)viewWillAppear:(BOOL)animated {
[self clearStory];
[self resetPages];
[self setNextPreviousButtons];
[appDelegate adjustStoryDetailWebView];
self.scrollView.contentOffset = CGPointMake(0, 0);
@ -158,7 +162,7 @@
}
- (void)transitionFromFeedDetail {
[self performSelector:@selector(clearStory) withObject:self afterDelay:0.5];
[self performSelector:@selector(resetPages) withObject:self afterDelay:0.5];
[appDelegate.masterContainerViewController transitionFromFeedDetail];
}
@ -166,9 +170,14 @@
[appDelegate adjustStoryDetailWebView];
}
- (void)clearStory {
- (void)resetPages {
[currentPage clearStory];
[nextPage clearStory];
currentPage.pageIndex = -1;
nextPage.pageIndex = -1;
self.scrollView.contentOffset = CGPointMake(0, 0);
}
- (void)resizeScrollView {
@ -296,11 +305,29 @@
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
self.isDraggingScrollview = YES;
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)newScrollView
{
self.isDraggingScrollview = NO;
[self setStoryFromScroll];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (keyPath == @"contentOffset" && self.isDraggingScrollview) {
CGFloat pageWidth = self.scrollView.frame.size.width;
float fractionalPage = self.scrollView.contentOffset.x / pageWidth;
NSInteger nearestNumber = lround(fractionalPage);
int storyIndex = [appDelegate indexFromLocation:nearestNumber];
appDelegate.activeStory = [appDelegate.activeFeedStories objectAtIndex:storyIndex];
[appDelegate changeActiveFeedDetailRow];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)newScrollView
{
[self scrollViewDidEndScrollingAnimation:newScrollView];
@ -333,6 +360,8 @@
nextPage = swapController;
}
if (currentPage.pageIndex == -1) return;
int storyIndex = [appDelegate indexFromLocation:currentPage.pageIndex];
appDelegate.activeStory = [appDelegate.activeFeedStories objectAtIndex:storyIndex];
[self updatePageWithActiveStory:currentPage.pageIndex];

View file

@ -49,11 +49,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.7</string>
<string>1.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7</string>
<string>1.8</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>