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
float count = 0.0; | |
for (AVPlayerItem *playerItem in self.player.items) { | |
CMTime duration = playerItem.asset.duration; | |
float durationSeconds = CMTimeGetSeconds(duration); | |
count = count + durationSeconds; | |
} | |
NSLog(@"total player duration: %.2f", count); |
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
NSMutableDictionary* params = [[NSMutableDictionary alloc] init]; | |
if([invitations count] != 0){ | |
NSString * stringOfFriends = [invitations componentsJoinedByString:@","]; | |
[params setObject:stringOfFriends forKey:@"to"]; | |
NSLog(@"%@", params); | |
} |
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
-(NSDictionary *) getDeviceData { | |
NSString *OSVersion = [[UIDevice currentDevice] systemVersion]; | |
NSString *deviceName = [self platformString]; | |
return @{@"OSVersion":OSVersion, @"deviceName":deviceName}; | |
} | |
- (NSString *) platform{ |
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
// Updates to LLVM give us better instantiation methods | |
NSNumber *n1 = @1000; // [NSNumber numberWithInt:1000] | |
NSNumber *n2 = @3.1415926; // [NSNumber numberWithDouble:3.1415926] | |
NSNumber *c = @'c'; // [NSNumber numberWithChar:'c'] | |
NSNumber *b = @YES; // [NSNumber numberWithBool:YES] | |
Arrays | |
// before | |
NSArray *words = [NSArray arrayWithObjects:@"list", @"of", @"words", 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
// To create a method that accepts an integer (int) and returns that integer squared | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// first we delare our integer | |
int myInt = 666 | |
// now look what's happening here - it will print "666 squared is 443556" |
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
// first add a clear button that covers the screen | |
// Now add a gesture recognizer in ViewDidLoad | |
// with target "self" (this class) | |
// and selector (method) "hideCamera" | |
UISwipeGestureRecognizer* upSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(hideCamera)]; | |
// set the direction of the swipe to up | |
[upSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionUp]; |
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)loadDocument:(NSString*)documentName inView:(UIWebView*)webView | |
{ | |
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil]; | |
NSURL *url = [NSURL fileURLWithPath:path]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:url]; | |
[webView loadRequest:request]; | |
} | |
[self loadDocument:@"iPhoneLibrary.key" inView:self.webView]; |