Skip to content

Instantly share code, notes, and snippets.

View thoretton-edwin's full-sized avatar

Edwin Thoretton thoretton-edwin

  • Slate Digital France
  • Grenoble
View GitHub Profile
@thoretton-edwin
thoretton-edwin / TableViewMethods.m
Last active August 29, 2015 13:56
iOS TableView cell methods with tab of NSDictionnary. tags : UITableView,UITableViewCell,cell,table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tab count];
}
@thoretton-edwin
thoretton-edwin / TabBarController.m
Last active August 29, 2015 13:56
iOS TabBarController as rootViewController
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.tabBarController = [[UITabBarController alloc] init];
SquaresViewController *squaresViewController = [[SquaresViewController alloc] initWithNibName:@"SquaresViewController" bundle:nil];
@thoretton-edwin
thoretton-edwin / UIWindow
Created February 15, 2014 08:12
iOS Good Practice: to set frame of UIWindow
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
@thoretton-edwin
thoretton-edwin / example.m
Last active August 29, 2015 13:56
iOS edit XML .plist file's data to NSMutableArray, NSDictionnary
//tab : NSMutableArray
tab = [[NSMutableArray alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"filename" ofType:@"plist"]];
@thoretton-edwin
thoretton-edwin / ImageViewExample.m
Last active August 29, 2015 13:56
iOS ImageView by file or url
// imgV1 is a UIImageView
-(IBAction)addImageView:(id)sender
{
NSLog(@"add image from repo");
if(imgV1==nil)
{
//just @"name" for png , other: @"name.extension"
UIImage* img = [UIImage imageNamed:@"image.jpg"];
@thoretton-edwin
thoretton-edwin / module.m
Last active August 29, 2015 13:56
iOS NSDictionary allocation and init
NSDictionary* dico=[[NSDictionary alloc]init];
dico = [NSDictionary
dictionaryWithObjects:@[@"http://www.google.com/favicon.ico",@"google",@"http://www.google.com"]
forKeys:@[@"favicon",@"nom",@"url"]];
@thoretton-edwin
thoretton-edwin / example.m
Created February 17, 2014 16:04
iOS Push second view controller : PresentViewController,UIViewController
// 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];
@thoretton-edwin
thoretton-edwin / dialog.java
Created February 18, 2014 07:08
Android progress dialog
wait = new ProgressDialog(this);
wait.show(this, « titre", " message ");
wait.dismiss();
@thoretton-edwin
thoretton-edwin / background.m
Created February 20, 2014 09:45
iOS edit background view with UIImage
//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];
@thoretton-edwin
thoretton-edwin / instruction.txt
Created March 9, 2014 11:13
iOS add custom font
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 :