This file contains 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
PFQuery *query = [PFQuery queryWithClassName:@"Videos"]; | |
[query whereKey:@"videoId" equalTo:[NSNumber numberWithInteger:[[item objectForKey:@"videoID"] integerValue]]]; | |
[query whereKey:@"model" equalTo:model]; | |
[query whereKey:@"zingVersion" lessThanOrEqualTo:[NSNumber numberWithInteger:CURRENT_VERSION]]; | |
[query orderByDescending:@"zingVersion"]; | |
// Go get the name of the video | |
[query getFirstObjectInBackgroundWithBlock:^(PFObject *video, NSError *error) { | |
if (error) { |
This file contains 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
function createVideo( thumbnail, videoSource ) { | |
var root = document.body | |
var vid = document.createElement("video") | |
vid.setAttribute("controls","controls") | |
vid.setAttribute("poster",thumbnail) | |
var src = document.createElement("source") | |
src.setAttribute("src",videoSource) | |
src.setAttribute("type","video/mp4") |
This file contains 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
document.addEventListener("DOMContentLoaded", | |
window.addEventListener("scroll", | |
function() { | |
var b = document.body | |
if (b.clientHeight + b.scrollTop >= b.scrollHeight) { | |
// ... | |
} | |
}) | |
if (b.clientHeight >= b.scrollHeight) { |
This file contains 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
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { | |
NSString *scheme = [[[request URL] scheme] lowercaseString]; | |
// Allow standard URLs through | |
NSSet *stdSchemes = [NSSet setWithObjects:@"http", @"file", nil]; | |
if ([stdSchemes containsObject:scheme]) { | |
return YES; | |
} | |
This file contains 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)videoEnterFullScreen:(NSNotification *)notification { | |
// Need to inform whoever is listening to hide my popover | |
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_POPOVER_HIDE object:nil]; | |
} | |
- (void)videoExitFullScreen:(NSNotification *)notification { | |
// Need to inform whoever is listening to show my popover | |
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_POPOVER_SHOW object:nil]; | |
} |
This file contains 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
// Temporarily hide a popover | |
- (void)hidePopover:(NSNotification *)notification { | |
self.hiddenPopoverContent = nil; | |
if (self.hiddenPopoverController) { | |
// Save some details of the current state | |
// Holding on to the content view means we can go back to the same state | |
self.hiddenPopoverContent = [self.hiddenPopoverController contentViewController]; | |
self.hiddenPopoverContentSize = [self.hiddenPopoverController popoverContentSize]; | |
This file contains 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
@implementation UIViewController (Rotation) | |
// iOS 6 | |
- (BOOL)shouldAutorotate { | |
return YES; | |
} | |
- (NSUInteger)supportedInterfaceOrientations { | |
return IPAD ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskAllButUpsideDown; |
This file contains 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
[self addChildViewController:modalViewController]; | |
[[modalViewController view] setFrame:[[self view] bounds]]; | |
[[self view] addSubview:[modalViewController view]]; | |
[modalViewController didMoveToParentViewController:self]; |
This file contains 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
static char const * const HiddenPopoverControllerKey = "HiddenPopoverController"; | |
static char const * const HiddenPopoverContentKey = "HiddenPopoverContent"; | |
static char const * const HiddenPopoverDelegateKey = "HiddenPopoverDelegate"; | |
static char const * const HiddenPopoverPresentingRectKey = "HiddenPopoverPresentingRect"; | |
static char const * const HiddenPopoverPresentingButtonKey = "HiddenPopoverPresentingButton"; | |
static char const * const HiddenPopoverArrowDirectionKey = "HiddenPopoverArrowDirection"; | |
static char const * const HiddenPopoverAnimatedKey = "HiddenPopoverAnimated"; | |
static char const * const HiddenPopoverContentSizeKey = "HiddenPopoverContentSize"; | |
static char const * const HiddenPopoverHidingInProgessKey = "HiddenPopoverHidingInProgress"; |
This file contains 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
@implementation UIViewController (RBPopoverPrivate) | |
- (UIPopoverController *)hiddenPopoverController { | |
return objc_getAssociatedObject(self, HiddenPopoverControllerKey); | |
} | |
- (void)setHiddenPopoverController:(UIPopoverController *)hiddenPopoverController { | |
objc_setAssociatedObject(self, HiddenPopoverControllerKey, hiddenPopoverController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
} |
OlderNewer