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
{ | |
MSheaderSeeenViewCell *clickedCell = (MSheaderSeeenViewCell *)[[sender superview]superview]; | |
[clickedCell.indicator startAnimating]; | |
[sender setHidden:YES]; | |
MSMovie *movie = [movies objectAtIndex:[self.tableView indexPathForCell:clickedCell].row]; | |
MSRESTRequest *getInfoRequest = [[MSRESTRequest alloc]initWithMethod:@"GET" | |
ressource:@"movies" | |
parameters:[NSArray arrayWithObject: | |
[NSString stringWithFormat:@"movie_id=%@", movie.udid]] | |
shouldEscapeParameters:YES]; |
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
//Recreate a partial route from server response, usefull in case of crash or other | |
+(void)recreateRouteFromCurrentServerRoute:(void (^)(WZRoute *))handler | |
{ | |
//Ask the server if the current user have a route to take action for | |
DMRESTRequest *request = [[DMRESTRequest alloc]initWithMethod:@"GET" ressource:@"routes/current" parameters:nil shouldEscapeParameters:NO]; | |
[request executeBlockRequest:^(NSURLResponse *response, NSData *data, NSError *error){ | |
if (data) { | |
NSJSONSerialization *json = [NSJSONSerialization JSONObjectWithData:data | |
options:NSJSONReadingMutableLeaves | |
error: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
- (void)webViewDidStartLoad:(UIWebView *)theWebView | |
{ | |
if (firstLaunch) { | |
firstLaunch = NO; | |
//As phonegap overwrite the main UI privately this method is used as the entry point to inject custom UI | |
//Phonegap nib are loaded and displayed, so safe to move them to another view | |
[self injectCustomUI]; | |
} |
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
+(BOOL)isIphone5 | |
{ | |
if ([[UIScreen mainScreen]bounds].size.height == 568.0) { | |
return YES; | |
} | |
return NO; | |
} |
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)onTwitterButton:(id)sender | |
{ | |
if ([TWTweetComposeViewController canSendTweet]) { | |
ACAccountStore *account = [[ACAccountStore alloc] init]; | |
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; | |
[HUD show:YES]; | |
[account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error){ | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
if (granted){ | |
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
// | |
// MSJSonParser.m | |
// MySeeen | |
// | |
// Created by Thomas Ricouard on 11/02/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import "MSJSonParser.h" |
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)encodeWithCoder:(NSCoder *)coder | |
{ | |
[coder encodeObject:self.udid forKey:@"udid"]; | |
[coder encodeObject:self.title forKey:@"title"]; | |
[coder encodeObject:self.alternateTitle forKey:@"alternateTitle"]; | |
[coder encodeObject:self.subtitle forKey:@"subtitle"]; | |
[coder encodeObject:self.seenStatus forKey:@"seenStatus"]; | |
[coder encodeObject:self.tinyImageLink forKey:@"tinyImageLink"]; | |
[coder encodeObject:self.normalImageLink forKey:@"normalImageLink"]; |
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
//Creating a file path under iOS: | |
//1) Search for the app's documents directory (copy+paste from Documentation) | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectory = [paths objectAtIndex:0]; | |
//2) Create the full file path by appending the desired file name | |
NSString *yourArrayFileName = [documentsDirectory stringByAppendingPathComponent:@"example.dat"]; | |
//Load the array | |
NSMutableArray *yourArray = [[NSMutableArray alloc] initWithContentsOfFile: yourArrayFileName]; | |
if(yourArray == 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
pragma mark - Orientation stuff | |
-(BOOL)shouldAutorotate | |
{ | |
if (isIpadIdiom) { | |
return YES; | |
} | |
return NO; | |
} | |
-(NSUInteger)supportedInterfaceOrientations |
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
CellSize size; | |
if (_list) { | |
size = CellSizeList; | |
} | |
else{ | |
//TODO: Factorize landscape/portrait code | |
//Randomize cell size and avoid hole | |
if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice]orientation])) { | |
if (_currentRowStatus == CellRowEmpty || | |
_currentRowStatus == CellRowOneSpaceUsed) { |