Part 1
Talkie is my newest product, the result of a collaboration with a good designer friend, Tim Churchward, who did the user interface.
Talkie is a little different from many of the other walkie talkie applications on the App Store (aside from the fact that much of it was written by me from our motorhome in Tunisia!), and I thought I’d write a little about some of the tech underpinning the app, and some of the choices we made. Along the way it may get a little tutorial-esque.
- This first part will introduce our initial motivations, and will talk about basic broadcast communications — the broadcast communications part may be very familiar to some, in which case it may be worth skipping to the next instalment.
- In the second part, I’ll continue the theme of networking, and will talk about what I ended up with for Talkie’s network code after addressing a couple of things, including switching to multicast.
- Finally, I’ll talk audio, dual platform development, and anything else I think of along the way (Actually, I’m aching to talk about one particular upcoming feature that had me jumping up and down when I first thought of it, but for now, mum’s the word on that one.) Read More
Easy rounded corners on UITableViewCell image view
Here’s a relatively easy way to achieve rounded corners on the standard image view in a UITableViewCell:
Set this up when you create the cell (make sure you
#import <QuartzCore/QuartzCore.h>at the top, of course). It would appear the UIImageView control creates sublayers to display the actual image content, which is why we use themasksToBoundsproperty to then clip any sublayers.I noticed a lot of people are seeking answers to the silly behaviour of UITableView with the grouped (
UITableViewStyleGrouped) style and images:Images don’t get clipped to the rounded cell border, which looks nasty. This technique is one way to remedy that:
One caveat – due to the inexplicable way the image view within the table view cell scales image content, there’s not really a simple, sensible way to provide an inset margin from the table view cell boundary to complement this rounded border effect.
I tried setting the
frameproperty of the UIImageView itself (cell.imageView.frame), as well as setting the frame of the image view’s layer. I also tried applying a scale transform to the layer, with strangely inconsistent results: Setting scale to, say, 50%, made the image view 40x40px, only a pixel or two smaller than the full size. This may be because another entity (the table view cell?) performs scaling of the content, instead of the actual image view; given that my original image was 80×80, a 50% scale would result in 40×40.My solution was to steer clear of that nonsense and just provide appropriately scaled images straight to the image view. Here’s a simple category on UIImage to scale an image:
So, then I just do something like this in the UITableView data provider:
Sorted.