Selective layer borders

March 4, 2012

I always though that the most annoying problems are the ones that should have been trivial. Those pesky problems that happen all the time, and for some reason apple didn’t take the time to fix them.

One such problem is the fact that there is no easy way to draw “selective” borders – i.e draw borders only on the left and top side of the view.

This problem keeps popping up for me, the last time was when I was trying to draw a grid view with custom cells. I wanted the cells to have a 1px border, but since all cell had both top and bottom borders, the borders seemed to be 2px wide.

This time I decided to solve this problem the right way and make a simple drop-in class that provides flexible border abilities – something that I could use like this:

myView.borderDirection = AUIFlexibleBordersDirectionRight | AUIFlexibleBordersDirectionTop;

Read the rest of this entry »