[Open Source]FVGravityView

No Comments

Hey folks, I’m proud to announce my new open source project for iPhone. It’s called FVGravityView. It’s basically an UIView that has the ability to fall. Yes, fall. It uses the accelerometer to detect the device position and the view will fall depending on it. It’s basically an UIView that recognizes gravity.

A few thing:
-The default velocity is 20, but you may change this value by changing the velocity property.
-FVGravityView supports dragging. To enable it, set the property isDragable to YES.
-Say you want to invert the gravity. Just set the isInverse to YES.
-It’s basically an UIView, so you may add subviews to it. It also has every drawing capabilities that an ordinary UIView has.

To download the sample project, click here.

PS: I didn’t try it on an iPad, but it should work with no problems at all.

RIP Sensitive Code

No Comments

Hey folks, unfortunately, my blog Sensitive Code is dead. I had no time to update it and ended up not renewing the domain registration. It had a great page rank. For example, if you type UIFileSharing on Google, a post from Sensitive Code it is the first result(not sure for how long). I moved every post from there to this blog, so everything is still available. I hope to write about programming on this blog in the future.

Easy multithreading, a courtesy of NSOperation

No Comments

Threading is known for being very hard in any language. A foolish mistake can make your application crash. Programmers spend a lot of time to make sure everything works fine. On Mac OS X 10.5, Apple finally introduced a very easy way to deal with threading. NSOperation is The Apple Way® to deal with threading. All you have to do is to subclass the NSOperation, create and initialize a NSOperationQueue, create and initialize the NSOperation and add it to the NSOperationQueue. For this tutorial, I will teach you how to write a simple app that will load a RSS feed and display it on a NSTableView.

To get started, go to Xcode and create a new project. I will call mine RSS Reader, but feel free to call it whatever you want. Let’s start by editing our AppDelegate.h. Create 3 IBOutlets:

More

[Quickies]Opening URLs in external applications

No Comments

Opening URLs on external applications is easy, no matter if you’re on an iPhone/iPod touch/iPad or on a Mac. On the Mac, we’d do something like this:

NSURL *URL = [NSURL URLWithString:@"http://www.sensitivecode.com"];
[[NSWorkspace sharedWorkspace] openURL:URL];

Simple, uh? Now let’s see how to do this on the iOS:

NSURL *URL = [NSURL URLWithString:@"http://www.sensitivecode.com"];
[[UIApplication sharedApplication] openURL:URL];

Easy peasy :)

ShareKit: sharing made easy

No Comments

Today being social means being cool. I mean, most apps have some sort of a sharing feature. There are tons of social networks, but the ones that hold most attention are Twitter and Facebook. Imagine yourself coding a share feature for each social network. Seems a bit painful, doesn’t it? So here’s the solution for your sharing problems! ShareKit is a framework which contains classes that allows you to share stuff on most popular social networks. ShareKit supports networks like ReadItLater, Facebook and Twitter.

Just copy a couple files to your project, import a header and implement a share feature with a few lines of code, and it’s done! Some networks will require you to get an API key, but ShareKit has a header file for you to configure it. Just paste your API keys and it’s configured.

You can download it and find more information on its official website.

FVImageSequence for Mac OS X/iOS

2 Comments

When I got to know Rainer Brockerhoff, one of my first questions was about networking. One of his advices was to write some open source code. A few days ago I was working on my customer’s app. He needed something similar to Apple’s 360° demo. I did not want to do that on a UIWebView as the performance is not the best. After looking for a view that does that, I found there was no one available. So I decided to write my own. Now I’m releasing it as an open-source project. The first of many.

FVImageSequence is basically a subclass of NSImageView/UIImageView that allows you to create the 360° effect by using a sequence of images. To use this view, you will have to add a image sequence to your project. All images must have the same prefix(i.e. myimage0.png, myimage1.png, myimage2.png). Set the prefix of the images you want to use by setting the prefix property.

You must also set the number of images. Just set the numberOfImages property in order to do that.

Also, don’t forget to set the property extension with the extension of the files(i.e png, jpg, gif).

Optionally you might set the increment property. This property basically tells the view how many images it should increment. If instead of incrementing 1 image, you want to increment 5, just set it to 5.

If you’re using the iOS version, don’t forget to enable the user interaction on Interface Builder.

Download the source code and the sample project from this link.

Fuck the clueless

No Comments

Rainer Brockerhoff used to tell that being clueless makes you get no answers for your questions. In the beggining, I didn’t understand why. Today I’ve finally figured out what a true clueless person is. And I’m talking about a person who has this word tattooed in her forehead.

I was trying to get some good reputation answering questions on Stack Overflow and a guy asked a question about getting information displayed in a custom way on a UITableViewCell. I told them to subclass it and add four UILabels to it. Problem solved, right? Wrong! The guy asked how they should do that. Well folks, I’m not sure if I’m talking about a guy who doesn’t know how to do that. What I know is that they wanted me to do the entire work for them, so they would just copy and paste the code and it would work like a magic. Yes, magic! No work at all. “Let me just get someone to do the work for me”.

Yeah guys, this is THE way to not get your questions answered. When asking something, try to learn from your question. Trying to get other people to do the work for you will not work. I recomend this great article by Matt Gemmell.

Rainer, you were right.

Looking for a job

3 Comments

I’m looking for a job in somewhere far from Brazil. I can do iOS, Mac and web development, but if I could pick I’d pick a Mac developer position. I sent my resume to a lot of companies around the world. I’m nervous. It’s always that same old question. Will I get hired? The problem is that the answer may be “No”, which is a very big problem to me. I really need a job and I’d do anything to get it. If any of my readers knows about someone who could hire me, please leave a comment or contact me. You can see my resume on the “Resume” page of this blog(what an obvious thing lol).

I still have more than a year to get a job outside Brazil, otherwise I will get my death sentence. OK, it’s not literally a death sentence, but I will be forced to join the army. Thanks to the crappy Brazilian law. No decent country has this kind of law. You don’t really want to know what happens in the Brazilian army. Ever since I was 13, I decided to get the hell out of this country, but as the time passes, my situation gets worse and worse. I hate this country, and now the president is a terrorist. How would you feel if Osama Bin Laden was the president of the country you live? Probably the same way I feel now.