iPhone App2, App3 & App4 compiled – this time in pure Objective-C

App 2


Well, here it is in amazing glory. The 2nd version of that good old programming stallwort, the “Hello World!” example application.

Now this one took me a bit longer to code and implement, HOWEVER, it’s pure Objective-C, not the hybrid app type that I used in Application #1. App1 was interesting, and fast to build, but it relies upon some pretty big external libraries. Not a big deal for a low-intensity application like I’m building right now, but the QuickConnect based hybrid app I first built comes with that (I think is) is a pretty high price to pay (with a couple of hefty line items)

  1. Every time you start the application, I get an unwanted QuickConnect Family Application splash screen. NO THANKS! I’m pretty sure I could hack around it, buy why bother, for now?
  2. It won’t run from XCode! I can get it to start, but it won’t actually Do anything.
  3. The hybrid HTML based application’s style sheets are partially ignored, things like the background and text colors are not honored, BUT the font family is. Very strange
  4. It’s a MAJOR pain in the ass to debug when you create it in DashCode… ‘deploy it’. Have to monkey around with several files to fill the XCode (Objective C based) language into using files it did not expect to need… it’s all very hacky and more kludgy than I like.

Honestly, with XCode view based building, I don’t think I need to mess around with the hybrid application model at all, at least for now. So.. the application that I built purly in HTML, CSS and JavaScript will be shelved for now. Instead I’m going to re-open my Objective C tutorials and work my way into the project I was working on originally.

It might be a pain in the butt to learn Objective-C, but in the end, I benefit. Question is, do I have the time and will to see it all the way through. I believe so. But until such time as I have the first application built and deployed on my phone.. it’s sort of.. moot. No?


App 3

App3

This one is not a View Based Application like number one, but this is what is called a Navigation Based Application.

Now, ever the hacker, I went beyond the code changes to RootViewController.m suggested in the book, and also had to fix some GLARING errors in the text (did they not have an editor look at this??). Anhow, this is the code that I wrote for the cell builder. The enhancements allow line wrap, and I changed the default font size from 17 to 13.


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:13.0];
}

cell.textLabel.text = @"This is my second Objective-C application.\nDespite the tutorial having MASSIVE bugs, I got it to run!"; // Configure the cell.

return cell;

}

I’m trying to decide if a View Based (winning so far) or a Navigation Based application will be the way I go for the Real Application. The Navigation Based app is a lot easier to get started with, and does not require that rather odd method of linking elements with the fishing line drag and connect method in the View Application.

Still a lot of code to write before I have enough experience to make a solid choice.


App 4

App4 is a derivative work of App3, but this time by simply enabling this little block of code, I get an Edit button and the ‘Delete’ context, if I need it, for the items. Pretty slick. Apple really went out and did a nice job on this SDK…

- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

Application 4 running in the iPhone simulator

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.