Posts Tagged ‘tool’

Interface Builder

April 26th, 2009

interfacebuilder

dev_interfacemedium

Interface Builder is a great utility for new developers. As you might know, it’s used to design your user interface.

In fact, everything you create in Interface Builder you can also programmatically in Xcode. What is more Xcode given you more possibilities of customization any objects like sliders, toolbars, switches, images, text fields and more.

So what are advantages and disadvantages of using Interface Builder?

Disadvantages? None. Advantages? A lot of!

Interface Builder is a great utility that allows you to visually create an interface, not to guess what is the proper width, height and placement using X and Y coordinates. You can create almost every 2D game and application faster if using Interface Builder. It makes your code shorter – you don’t have to create the outlets manually, they are already created for you.

I will show you an example. How to create programmatically in Xcode a label:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 50.0, 70.0, 30.0);];
label.textColor = [UIColor blueColor];
label.backgroundColor = [UIColor brownColor];
[label setText:@"My Text"];
label.textAlignment = UITextAlignmentCenter;
[self.view addSubview:label];

You will obtain the same result dragging & dropping the label from the I.B. Library to the view. Customization – like changing the text or background colour can be chosen from it’s menus, and while doing this, you track the changes and have full control if the new look matches the interface. But, customization is limited to keep I.B. window clear. You can’t rotate an label for example, but once you created an object and connected it to the right outlet Xcode can do the rest.

That was only an example. Interface Builder is really helpful and being a good programmer doesn’t mean the you have to use only Xcode. Relax, and play with I.B. every static content can be loaded from .xib files I.B. creates for you. Xcode will be necessary usually only if there is unknown number of objects to be displayed in the application.

iPhone Simulator

April 24th, 2009

simulator1simulator2simulator3

dev_simulatormediumiPhone Simulator is a tool that allows you to quick debug your applications. It’s almost the perfect copy of the real device, but it has some major and minor differences. The main advantage of using the simulator is that applications get loaded within few seconds. You can/should use simulator on the early stage of development.

Differences:

  • although there is almost the same environment, iPhone simulator doesn’t run as much system application as the real devices, so the bigger applications can run smoothly on simulator bot do not on real device
  • internet access to simulator is only passed via computer and treated like WiFi a, you cannot test how your application is using 3G or other cellular data transfer
  • you can’t control acceleration, you can turn the iPhone landscape and portrait mode, but you cannot tilt it to controls the games using accelerometer
  • you can’t use GPS feature to get location or track its changes
  • you can “touch” the simulator using one “finger” or two (hold the option key), but it’s impossible to use most of multi touch gestures or touch simulator with more “fingers”
  • you can’t use vibration alert
  • many sounds or musics won’t play on simulator, what is more some frameworks and classes to hold the sounds cannot be compiled to run on simulator
  • you can’t use a camera
  • you don’t risk damaging the real device if you get frustrated
  • iPhone simulator cannot be jailbroken, or I don’t know how
  • you can’t put any case on it

iPhone Simulator has almost the same functionality as a real device. You terminate an application by pressing the home button, you can turn it left, right, toggle in-call status bar, simulate memory warning and lock it. When installed you have access to apps like: Photos (with some albums), Settings (General, Safari and Photos settings), Safari and Contacts. To install your own app on simulator, in Xcode set Simulator – iPhone OS [firmware version] as Active SDK an Debug as Active Build Configuration.