This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout( function(){ window.scrollTo(0, 0.1) }, 100 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example viewDidLoad | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self loadWebView]; | |
} | |
// The example loader | |
// | |
// Assumes you have an IBOutlet for the UIWebView defined: @property (strong, nonatomic) UIWebView *wv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming SomePageViewController has a property called idx that holds its page number. | |
// Some number | |
#define MAX_PAGES 5 | |
// Factory method | |
- (UIViewController *)viewControllerAtIndex:(int)i { | |
// Asking for a page that is out of bounds?? | |
if (i<0) { | |
return nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming again pageViewController.viewControllers returns the | |
// NSArray of UIViewControllers and the object at index 0 is the | |
// current view controller---which has a property idx indicating | |
// the current page. | |
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController { | |
int currentPage = [[pageViewController.viewControllers objectAtIndex:0] idx]; | |
return currentPage; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming property UIPageViewController *pager. | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Create it. | |
self.pager = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; | |
// Point the datasource back to this UIViewController. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)goToPreviousPage:(id)sender { | |
int currentPage = [[self.pager.viewControllers objectAtIndex:0] idx]; | |
// Don't do anything if we're already at the first page | |
if (currentPage =< 0) { | |
return; | |
} | |
// Instead get the view controller of the previous page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:(currentPage - 1)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)goToFirstPage:(id)sender { | |
int currentPage = [[self.pager.viewControllers objectAtIndex:0] idx]; | |
// Don't do anything if we're already at the first page | |
if (currentPage =< 0) { | |
return; | |
} | |
// Instead get the view controller of the first page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "YourAppHere", | |
"version": "0.0.1", | |
"devDependencies": { | |
"grunt": "~0.4.2", | |
"grunt-contrib-jshint": "~0.6.3", | |
"grunt-contrib-nodeunit": "~0.2.0", | |
"grunt-contrib-uglify": "~0.2.2" | |
}, | |
"dependencies": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
exec:{ | |
build:{ | |
command:"phonegap build ios", | |
stdout:true, | |
stderror:true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *allUrlsInDirectory = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; | |
NSURL *documentsFolderURL = [allUrlsInDirectory lastObject]; |