Honestly, I’ve not documented much here on the blog like I had intended. Read more
Tag Archives: Objective C
One thing you will find you need to do in any programming language is do math. Here are some useful math functions for the Objective C language. I give a little bit of a comparison to Visual Basic for those who know that language. They are provided in no special order:
- fabs() – Gets the absolute value of the value in parentheses. Works like ABS() function in Visual Basic. fabs(-123) = 123, fabs(34) = 34.
- ceil() – Find the ceiling integer. Kind of like rounding up. Same as INT(x+1) in Visual Basic. ceil(3.1) = 4.
- floor() – Find the floor integer. Kind of like rounding down. Same as INT(x) in Visual Basic. floor(3.6) = 3.
- exp() – Find the exponential value.
- pow() – Raise a number to the power. pow(3,6) = 3^6 in Visual Basic.
- rand() – Generate a pseudo random number. Function is RND(x) in Visual Basic. A good discussion on random numbers in Objective C can be found here.
- srandom() – Generate a seed for the random number generator. This is done with the Randomize statement in Visual Basic.
- sqrt() – Find out the square root of a number. sqrt(x) = x^(1/2) in Visual Basic.
Note: Video is Best Viewed in Full Screen Mode
As I began refining some sample code for making Universal Apps for the iPhone and iPad, I sought a way to make my code as concise as possible. I needed to determine if the app was running on an iPad or iPhone/iPod Touch and use it to my advantage. This basic information is contained in the UIDevice class.
Actually, its been up for a while now. And, after about 4 attempts, I was able to download the iPhone SDK!
There is allot here to digest. I’ve never programmed in Objective-C before. It is a bit overwhelming.
Note: I submitted a request for the $99 license key. Looks like I’ll have to wait for a response from Apple. Based on the load their site received from would-be iPhone developers, I might be waiting for awhile!