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
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) | |
{ | |
[locationManager requestAlwaysAuthorization]; | |
} | |
// auth needed before start method | |
[locationManager startUpdatingLocation]; | |
// in plist file : (Boolean value) NSLocationAlwaysUsageDescription : 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
int screenWidth = 0; | |
int screenHeight = 0; | |
if(android.os.Build.VERSION.SDK_INT < 10) { | |
Display display = getWindowManager().getDefaultDisplay(); | |
screenWidth = display.getWidth(); | |
screenHeight = display.getHeight(); | |
} else { | |
DisplayMetrics metrics = new DisplayMetrics(); | |
getWindowManager().getDefaultDisplay().getMetrics(metrics); | |
screenWidth = metrics.heightPixels; |
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
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { | |
// Load resources for iOS 6.1 or earlier | |
} else { | |
// Load resources for iOS 7 or later | |
} |
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
Fragment frag; | |
//ajout d'un fragment | |
TonFragment newFragment = new TonFragment(); | |
android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); | |
transaction.add(R.id.fragment_container, newFragment).addToBackStack("A_B_TAG"); | |
transaction.commit(); | |
//remplacement d'un fragment |
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
NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0]; | |
if([language isEqualToString:@"fr"]){//...} |
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
In plist file : | |
1) add "Fonts provided by application" item in property list | |
2) drag the .ttf or .otf file in supporting file folder | |
Warning ! check case "add target" | |
3) add string item in Fonts provided by application array : example "myFont.ttf" | |
4) in the module : |
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
//Background design | |
UIGraphicsBeginImageContext(self.view.frame.size); | |
[[UIImage imageNamed:@"appBackground.png"] drawInRect:self.view.bounds]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
self.view.backgroundColor = [UIColor colorWithPatternImage:image]; |
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
wait = new ProgressDialog(this); | |
wait.show(this, « titre", " message "); | |
wait.dismiss(); |
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 push, add in the UIViewController : | |
MyUIViewController *second = [[LoginUIViewController alloc] initWithNibName:nil bundle:nil]; | |
[self presentViewController:second animated:YES completion:nil]; | |
// in the second view controller add | |
[self dismissViewControllerAnimated:YES completion: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
NSDictionary* dico=[[NSDictionary alloc]init]; | |
dico = [NSDictionary | |
dictionaryWithObjects:@[@"http://www.google.com/favicon.ico",@"google",@"http://www.google.com"] | |
forKeys:@[@"favicon",@"nom",@"url"]]; |