Skip to content

Instantly share code, notes, and snippets.

@zerho
Created May 28, 2015 11:50
Show Gist options
  • Save zerho/e083034368dc25d24cf6 to your computer and use it in GitHub Desktop.
Save zerho/e083034368dc25d24cf6 to your computer and use it in GitHub Desktop.
a simple example of how you write stuff from java to ObjectiveC
Persona p = new Persona();
Persona * p = [[Persona alloc] init];
Persona p = new Persona("Matteo");
Persona * p = [[Persona alloc] initWithName:@"Matteo"];
Persona p = new Persona("Matteo","M");
Persona * p = [[Persona alloc] initWithName:@"Matteo"
andSex:@"M"];
obj.sendMail(mail,body); // JAVA
[obj sendMailTo:mail withMessage:body]; // OBJ-C
[ciao isEqual:pass]
// Any Controller
[p1 isEqual:p2]
// Class Persona
- (BOOL)isEqual:(id)object {
if([object isKindOfClass:Persona]) {
Persona *compare = (Persona*) object;
if( [self.cf isEqual:compare.cf] &&
[self.birth isEqual:compare.birth] ){
return YES;
} else
return NO;
}
else
return NO;
}
NSObject *obj;
UIButton *btn = [[UIButton alloc] initWithName:@"ciao"];
// Array
Persone[] array = {p1,p2};
NSArray * array = @[p1, m2, c3];
anArray[0]
[anArray objectAtIndex:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment