Permalink
Browse files

Added method for getting current page.

  • Loading branch information...
1 parent ff776a2 commit f7115db24fa8bba15c881ce1b9e551c770c8e9bc igerm committed Apr 25, 2012
Showing with 7 additions and 4 deletions.
  1. +2 −1 INPageScrollView/Clases/INPagedScrollView.h
  2. +5 −3 INPageScrollView/Clases/INPagedScrollView.m
@@ -34,7 +34,8 @@
- (void)reloadData;
- (void)insertPageAtIndex:(NSInteger)page;
- (void)removePageAtIndex:(NSInteger)page;
-- (void)scrollToPageIndex:(NSInteger)page;
+- (void)scrollToPageIndex:(NSInteger)page animated:(BOOL)animated;
- (void)refreshPageAtIndex:(NSInteger)page;
+- (NSInteger)indexForCurrentPage;
@end
@@ -479,17 +479,19 @@ - (void)refreshPageAtIndex:(NSInteger)indexBeingRefreshed {
}
}
--(void) scrollToPageIndex:(NSInteger)page {
+-(void) scrollToPageIndex:(NSInteger)page animated:(BOOL)animated{
if (page < 0) {
page = 0;
} else if (page > pageCount-1) {
page = pageCount -1;
}
- [self setContentOffset:CGPointMake(self.frame.size.width*page, 0) animated:YES];
+ [self setContentOffset:CGPointMake(self.frame.size.width*page, 0) animated:animated];
//self.contentOffset = CGPointMake(self.frame.size.width*page, 0);
}
-
+- (NSInteger)indexForCurrentPage {
+ return currentPage;
+}
- (IBAction) test {
NSLog(@"------");

0 comments on commit f7115db

Please sign in to comment.