How to overload the back button of a UITableViewController


Finally a technical post!

I was doing an iPhone assignment the other day where I am creating a simple FTP directory listing app. The problem was that I could change views during an FTP call (asynchronous) by hitting the back button, but the request would continue and then break my app with an “EXC_BAD_ACCESS” error. So I wanted to be able to run code on that back button press to stop FTP request.

However, this is not a simple thing to find out how to do! Some people on StackOverflow suggested putting in a custom back button with a selector pointing to a function, but the new button didn’t look as nice as the default one and lost the naming features. But then I came across this http://stackoverflow.com/a/1816682 which suggests to use viewWillDisappear. I kill the FTP connection in this function (if its currently running) and now everything is peachy!

- (void)viewWillDisappear:(BOOL)animated {
NSArray *viewControllers = self.navigationController.viewControllers;
if ([viewControllers indexOfObject:self] == NSNotFound) {
if (self.activityIndicator.hidden == NO){
[self stopReceiveWithStatus:@"Cancelled"];
}

NSLog(@"View controller was popped");
}
}

iPhoneFTP

Poll Time: The First is About iPods


I don’t personally own an iPod (yes I’m one of those people), but I know that I never use my  Zune since I got an iPad or smartphone. Why did I make this specifically about iPods? Probably because everyone knows what I mean when I say iPod, as opposed to the confusion caused by other DAPs (Digital Audio Players) in general.

Two in one day!


A couple of things to note:

  • I understand that most people don’t comment, knowing that people read what I write is enough for me!
  • If you like polls, you are in the right place. I’m rather impartial to polls, and will try to post one at least once a week.
  • I hate it when sites say, “Under Construction”. A static website is basically a dead one.
  • Like most of the population, I’m a fan of cute pictures of puppies. There won’t be a lot here, but they may appear from time to time (especially Riley… see below).
  • I like lists. Always check the bottom to see where I end up!
Riley the dog; out on a walk

Dog: Exhibit A

Hello world!


Rare visible sunset in NL

Welcome to my blog. If you are looking for the blog of Nicholas Noel, computer engineer extraordinaire, this is it!

I have been looking for a reason to blog / a topic to blog about for some time. This was the kick in the butt I needed:

http://www.jobacle.com/blog/5-ways-a-personal-blog-can-boost-your-career-2.html

Charles Sipe outlines some good points about having a personal blog to promote a positive online presence. I have been making use of this for some time, but I do agree that a blog can be a great way to expand my exposure. This will also give me a chance to practice this writing thing that everyone’s talking about.

Potential employers or clients, feel free to contact me at any time.

Nicholas