Tools of trade for the .Net developer

So I was going to put together tools of the trade list untill I came across this article by that Hanselman fellow:
http://www.hanselman.com/blog/ScottHanselmans2009UltimateDeveloperAndPowerUsersToolListForWindows.aspx

Its  massive… has all the tools I was going to mention and a million more. Most are totally free – and most make a serious difference to your .NET day.

Dom

Advertisement

iPhone Project 1

Background

  • This is the first iPhone app I wrote last year
  • There is not a lot of code!!!
  • Best way to do this is just copy the code in XCode as needed and follow the simple instructions below about creating the UI in Interface Builder

Requirements

  • Provide effective light from the iPhone in Darkness
  • On/Off Switch
  • No Fade Out/Dim
Specification
  • See screen below.

  • Label is White when torch is on (Yes this is a very simple torch!)
  • Label is black when torch is off
  • On Application start torch is off
  • Off/On button toggles the light
Test
  • None required at this stage (OK so my objective C needs to get improved before I start building unit tests first). I promise it will happen …. yeah yeah.

Code (Please Note was built with XCODE 3.0.1)

  • iPhone_TorchViewController.h

//  iPhone_TorchViewController.h
//  iPhone Torch
//
//  Created by Dom Millar on 31/08/09.
//  Copyright DOMSCODE 2009. All rights reserved.
//
#import
@interface iPhone_TorchViewController : UIViewController {
IBOutlet UILabel *torchlabel;
}
@property (retain,nonatomic) UILabel *torchlabel;
-(IBAction)buttonPressed:(id)sender;
@end
  • iPhone_TorchViewController.m (Important Bits)

#import “iPhone_TorchViewController.h”

@implementation iPhone_TorchViewController
@synthesize torchlabel;
-(IBAction)buttonPressed:(id)sender
{
NSString *buttonTitle = [sender titleForState:UIControlStateNormal];
if([buttonTitle compare:@”On”] == NSOrderedSame)
{
[torchlabel setBackgroundColor:[UIColor whiteColor]];
}
else
{
[torchlabel setBackgroundColor:[UIColor blackColor]];
}
}

– (void)dealloc {
[torchlabel release];
[super dealloc];
}
Ok so now to hook up to the UI build the code in XCode then open the XIB File. Add the UI elements to the main view like in the above screenshot (1 label with background black, 2 buttons). Then hooking up the outlets and action is easy. Two steps in fact:
1. Option click on the File Owner and drag from the label item to the actual big label on the view.
2. Click on each of the buttons and bring up the button connections. Click on the Touch Up Inside connection and drag that to the File Owner – selecting the button pressed action. Make sure you do this for both buttons.


Issues
  • Should make it a bit more funky (FlashLight – Version 2)
  • Using the title of the buttons to determine which one pressed is a bit dodgy – will see if we can improve this

Summary

Ok so this was an extremely simple applIcation and no test driven development (Curse you Dom) but was achieved in just over an hour and considering this is my first iPhone app – I am pretty happy. In terms of the process, it was all fairly basic but as we consider this series of Projects you’ll see things get more complex.

Dom

Update on Monotouch

OK there’s been a lot of noise on the monotouch mailing lists relating to a change in the developer agreement with iPhone OS4 (Currently beta), specifically this clause…

“Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine”

Check the monotouch site for further information http://www.mono-project.com/newstouch/archive/2010/Apr-19.html

Dom

Free CodeCampOZ on again ( 21-22 November in Wagga)

For east coast Australian .Net developers this is a  great free training option – I have been to the last few and they are great . The presenters are very good and the amount of code you’ll see is excellent. All you need to do is make a reservation, get yourself to wagga and organise your own accomodation for a weekend in late november.

impressive www.codecampoz.com

Upgrading from Leopard to Snow Leopard – for XCode and Monotouch

I just thought it was worthwhile documenting the upgrade process I had to go through upgrading my mac from Leopard to Snow Leopard, as it was a bit of a pain.

My starting point was:

Leopard
Monotouch 1.0
MonoDevelop 2.4
iPhone SDK 3.0.1

How I upgraded:

SnowLeopard Upgrade
SDK for Leopard 3.1.2 –  Note: I tried Monotouch at this point and it failed so then embarked on the following:
MonoFramework 
MonoDevelop 2.2 (beta)
MonoTouch 1.1
Then Discovered 3.1.2 was avail
SDK for Leopard 3.1.2 (Note for young players encountered some problems because the simulator was running and was kept stopping the install – closed he simulator and all fixed)

Then all worked fine!!!!

Hope this helps
Dom