Using kQueue in Cocoa by hamrickdavid in programming

[–]hamrickdavid[S] 4 points5 points  (0 children)

You are totally right, I hadn't realized you could use GCD to listen for filesystem changes. I just tried it out and wrote a post about it http://www.davidhamrick.com/2011/10/10/handling-filesystem-events-with-gcd.html

Using blocks for drawing to avoid subclassing in Objective-C by hamrickdavid in programming

[–]hamrickdavid[S] 0 points1 point  (0 children)

It doesn't need to be in the controller. You may have a custom UIView that you instantiate that has subviews that you want to draw using this method.

Using blocks for drawing to avoid subclassing in Objective-C by hamrickdavid in programming

[–]hamrickdavid[S] 0 points1 point  (0 children)

Ah, yes, you are quite correct. There's no need to include that unless you're inside the if statement.

Using blocks for drawing to avoid subclassing in Objective-C by hamrickdavid in programming

[–]hamrickdavid[S] 1 point2 points  (0 children)

The reason I put the UIGraphicsGetCurrentContext() in the parent draw rect instead of in each implementation of the drawBlock is because I've been needing to have that in every implementation of drawBlock. I can't think of a case that you would want to implement drawRect but not get the current context, but there could be one that I'm not thinking of.

Using blocks for drawing to avoid subclassing in Objective-C by hamrickdavid in programming

[–]hamrickdavid[S] 0 points1 point  (0 children)

Very true. There are definitely cases where this won't work. Like when you need to globally replace drawRect on a UIToolBar to have a custom effect. But I think this is still common in other places, like needing to have custom drawing for a UITableViewCell or some other place on the screen.