Skip to content
Browse files

Removed pullToDetachPages option (it's always on now).

  • Loading branch information...
1 parent 643c67b commit 782100d3a2e23fe78c2257cf8970460022a3f807 @bejo bejo committed May 28, 2012
View
8 src/FSPanes/FSPanesNavigation/FSPanesNavigationView.h
@@ -36,8 +36,6 @@
CGFloat _leftInset;
CGFloat _widerLeftInset;
- BOOL _pullToDetachPages;
-
struct {
unsigned int willDetachPages:1;
unsigned int isDetachPages:1;
@@ -61,12 +59,6 @@
*/
@property(nonatomic) CGFloat widerLeftInset;
-/*
- * If YES, then pull to detach pages is enabled, default YES
- */
-@property(nonatomic, assign) BOOL pullToDetachPages;
-
-
- (void) pushView:(UIView*)newView fromView:(UIView*)fromView animated:(BOOL)animated;
- (void) pushView:(UIView*)newView fromView:(UIView*)fromView animated:(BOOL)animated viewSize:(FSViewSize)viewSize;
View
47 src/FSPanes/FSPanesNavigation/FSPanesNavigationView.m
@@ -25,7 +25,7 @@ - (void) didStartPullingToDetachPages;
- (void) didPullToDetachPages;
- (void) didCancelPullToDetachPages;
- (void) sendAppearanceDelegateMethodsIfNeeded;
-- (void) sendDetachDelegateMethodsIfNeeded;
+- (void)sendDetachDelegateMethodsIfNeeded;
@end
@interface FSPanesNavigationView (Private)
@@ -68,7 +68,6 @@ @implementation FSPanesNavigationView
@synthesize delegate = _delegate;
@synthesize dataSource = _dataSource;
@synthesize widerLeftInset = _widerLeftInset;
-@synthesize pullToDetachPages = _pullToDetachPages;
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
@@ -86,7 +85,6 @@ - (id)initWithFrame:(CGRect)frame {
self.leftInset = DEFAULT_LEFT_INSET;
self.widerLeftInset = DEFAULT_WIDER_LEFT_INSET;
- self.pullToDetachPages = YES;
[self addSubview: _scrollView];
@@ -612,6 +610,7 @@ - (FSPaneView *)_createPaneWithView:(UIView*)view size:(FSViewSize)viewSize {
- (void)_unloadPageIfPossible:(NSInteger)index
{
//TODO: USE THIS METHOD INSTEAD OF -UNLOADPAGE: !!! (WHEN APPROPRIATE :)
+ // (otherwise -visiblePanes: shouldn't include wide views)
FSPaneView *pane = [_pages objectAtIndex:index];
if (pane.isLoaded) {
@@ -704,11 +703,9 @@ - (CGPoint)_calculateOriginOfPageAtIndex:(NSInteger)index
}
#pragma mark -
-#pragma mark UIScrollView delegates methods
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
-
+#pragma mark <UIScrollViewDelegate>
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+{
if(scrollView.dragging && scrollView.tracking && !scrollView.pagingEnabled) {
[scrollView setPagingEnabled:YES];
}
@@ -729,7 +726,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
// bug fix with bad position of first page
if ((firstVisiblePageIndex == 0) && (-_scrollView.contentOffset.x >= _scrollView.contentInset.left)) {
// get page at index
- FSPaneView* page = [_pages objectAtIndex: firstVisiblePageIndex];
+ FSPaneView *page = [_pages objectAtIndex:firstVisiblePageIndex];
if (page.isLoaded) {
CGRect rect = [page frame];
rect.origin.x = 0;
@@ -741,21 +738,18 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
// operations connected with blocking pages on stock
for (NSInteger i=0; i<=firstVisiblePageIndex; i++) {
-
- // check if page index is in bounds
- if ([self _pageExistAtIndex: i]) {
- // get page at index
- FSPaneView* page = [_pages objectAtIndex: i];
+ // check if page index is in bounds
+ if ([self _pageExistAtIndex:i]) {
+ FSPaneView *page = [_pages objectAtIndex:i];
if (i == firstVisiblePageIndex) {
-
CGFloat contentOffset = _scrollView.contentOffset.x;
if (((i == 0) && (contentOffset <= 0)) || ([_pages count] == 1)) {
return;
}
- UIView* view = (UIView*)page;
+ UIView *view = (UIView *)page;
CGRect rect = [view frame];
rect.origin.x = contentOffset;
@@ -771,19 +765,17 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
+- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
+{
}
-/////////////////////////////////////////////////////////////////////////////////////////////////////
//- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
// [scrollView setPagingEnabled:NO];
//}
-///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
+{
if (_flags.isDetachPages) _flags.isDetachPages = NO;
#ifdef CONTESTED_CASE
@@ -801,10 +793,8 @@ - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
-
- if (!_pullToDetachPages) return;
-
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+{
CGFloat realContentOffsetX = _scrollView.contentOffset.x + _scrollView.contentInset.left;
if ((_flags.willDetachPages) && (realContentOffsetX < - _scrollView.frame.size.width * PULL_TO_DETACH_FACTOR)) {
@@ -941,10 +931,11 @@ - (void) sendAppearanceDelegateMethodsIfNeeded {
///////////////////////////////////////////////////////////////////////////////////////////////////
-- (void) sendDetachDelegateMethodsIfNeeded {
+- (void)sendDetachDelegateMethodsIfNeeded
+{
CGFloat realContentOffsetX = _scrollView.contentOffset.x + _scrollView.contentInset.left;
- if ((_pullToDetachPages) && (!_flags.isDetachPages)) {
+ if (!_flags.isDetachPages) {
if ((!_flags.willDetachPages) && (realContentOffsetX < - _scrollView.frame.size.width * PULL_TO_DETACH_FACTOR)) {
[self didStartPullingToDetachPages];
}

0 comments on commit 782100d

Please sign in to comment.
Something went wrong with that request. Please try again.