Oct 15
PelaezDevelopment, Source Code, Tips, iPhone code, Shake, Source Code
This is a class I made to detect shakes. It’s really simple, you just create an object, initialize it, set a delegate, and it will send messages to the delegate when the movement change is significant, then your object can do whatever you want, like refreshing info or whatever.
Details:
- Detects side shakes.
- Has a mechanism to avoid sending multiple messages for one long shake.
- Sensitivity can be edited easily.
- It has it’s protocol, so you don’t have to add new methods to your receiver’s interface.
- It uses #ifndef’s so it can be imported several times without causing errors for having the same class multiple times.
- Only one can be working at the time (activating a new one will deactivate the previous working one).
More
May 28
PelaezJava, Source Code, Tips, Tutorials code, Java, Tips
This is a “tip” on making an efficient buffer in which, after you use the first object in it, it is removed from it.
More
May 07
PelaezBlog code, console, terminal
This is like an introduction to understand this blog’s types of text better:
Types of Text:
//Comments
if([postText isSourceCode]){
}
"Strings"
How I write code
This are the “rules” I follow when writing code:
1 2 3 4 5 6 7 8
| //Camel-cased object names, no spaces before '['.
UILabel *myLabel = [[UILabel alloc] init];
if(condition){ //Brackets in the same line
/*if there are a lot of things nested, sometimes I comment
after the bracket to know what it closes, also in special
ocations like class/interface declarations*/
} //if
rect = CGRectMake(0.0f, 0.0f, 320.0f, 460.0f); //Spaces after comas, but not before. |
Terms
iDevice – With this I refer to the iPod Touch or iPhone, whichever you are using
I’ll add more as I need them.