Aleksandar • Vacić

iOS bits and pieces

Problem: UICollectionViewCell redraw during interactive resize of UICollectionView

I’m very close to finishing the next big update of Unitica. Headline feature is that app is now Universal and I’ve built custom container controller that looks like this:

Update (Jul 6th, 2015): it’s a stupid bug on my side, see the end of this post.

I added background colors to clearly visualize the various child levels; at the top you have my custom split view controller with two child controllers:

  • category collection view controller
  • columns controller

This ColumnsController has two child controllers (orange and yellow) - each an instance of UnitViewController, which is UICollectionViewController subclass. Green and bluish violet are actual collection view cells. Layout is UICollectionViewFlowLayout subclass where I make sure that cells always span the full width of the collection view.
This is the most relevant part of the layout:

- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
  return YES;

- (void)prepareLayout {
  CGFloat w = floor(self.collectionView.bounds.size.width);
  CGSize is = self.itemSize;
  is.width = w;
  self.itemSize = is;
  [super prepareLayout];

The problem I have is that I want to allow changing the split position between the CategoryController and ColumnsController. You just drag the divider in the middle to set the sizes as you wish. Or you can slide them all the way to the edge and have one of those full screen.

This simply refuses to obey and I’m out of ideas what to try to force a proper redraw. Here’s the video that illustrates the problem.

The App Store's slow grind

Last few days, the mood turned way too sombre among iOS app developers. I see it going in cycles, but the worrying trend is that period between those days is getting shorter. This time is was sparked by Jared Sinclair’s post about the sales numbers for one of the best RSS readers on iOS: Unread.

Given the feature placements on the App Store, glowing reviews at prominent blogs - I expected this app to have earned at least 300-400k. Instead, it barely eked out over 40k. For such a quality app, this is really disheartening.

Many people chimed in, before and after with varying thoughts, but frankly - the mood is not good. I may be wrong, but I think that Jared is now in the position where I was about 3-4 years ago, but with way more success and recognition than I had back then and now. Which is fantastic position to bounce up, if he chooses to do so.

Auto layout exception thrown when deleting UICollectionViewCell

I am preparing my main apps to be compatible with iOS 8 and upcoming new devices of possibly varying physical sizes. First order of business: remove any hard-coded 320 values in various places.

In Units convert (note: the upcoming version 3.0 will be called Unitica) I have a very complex cell in the favorites screen.

When you swipe over that cell, you get the option to remove that particular favorited pair; doing that triggers cell removal and adjustment of the position of cells below. And it throws this lovely exception doing that:


Meyerweb: So Many Nevers

Freaking shit how this is ripping me out, the last several days. So much pain, so hard to express.

I grew professionally with Eric’s books and sites for years and years. It’s strange how you can get yourself into thinking you actually know a person, without never actually speaking to him. But to so many of us who believed in web standards and stuff back at the start of the century Eric was one of the several beacons we looked up to, someone who relentlessly pushed the movement forward.
I lived and breathed the web back then and Eric Meyer was a household name, a mentor of sort.

To have him and his family going through this is so unjust. Only…there’s no justice nor guilt nor anything really when it comes to cancer. It just happens, a Mother of all bad jackpots.

RIP Becca