How would you explain the following code never getting into the if clause? Bear in mind I already knew it to be true at least once. I was an absolute true.

1
2
3
4
5
6
7
8
9
10
for (UIView *subview in view.subviews)
{
    CGFloat subviewAlpha = subview.alpha;
    CGFloat myAlpha = 0.15f;
    if (subviewAlpha == myAlpha &&
        [subview isKindOfClass:NSClassFromString(@"_UIPopoverViewBackgroundComponentView")])
    {
        subview.alpha = 0.f;
    }
 }

This year I went to Apple’s WWDC for the first time. I got the chance to be where every iOS developer wanted to be. The place where stuff happened. The place with the best among all. The place that mattered.

At WWDC 14, Apple introduced its new programming language: Swift. Nobody knows for sure what will happen to Objective-C, but one can only guess it won’t be around for long. My guess is that Apple will be accepting ObjC apps up till iOS 10, but that is just my guest.

You can unregister a UICollectionView supplementary view by re-registering it with nil class as stated in Apple’s docs. (Remember to use the same reuseIdentifier).

[self.collectionView registerClass:nil
        forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
               withReuseIdentifier:kHEADER_IDENTIFIER];

Anyone that have recently developed any pods for Cocoapods know that resources should be gathered using the resource_bundles option. What is quite hard to figure out is how, exactly, to access those resources once they’re set up in the bundle. It seems obvious now that I got it working, but I struggle a lot since there wasn’t anything in Stackoverflow or anywhere else that provided the answer I came up with.

After setting up the resource_bundles, Cocoapods copies the resources found in a “resources” folder within the Pods project, but none of them are added in the target’s “Copy bundle resources”. For that reason, I couldn’t access any of the Pod’s images or xibs in my project. Every time XCode threw me this error:

‘Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Could not load NIB in bundle:<{PATH_TO_APP}> (loaded)’ with name ‘{VIEW_CONTROLLER_NAME}’

The obvious solution that wasn’t listed anywhere is using the Cocoapods generated bundle (which the folder actually doesn’t exist) as a NSBundle:

NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"MyBundle" ofType:@"bundle"];

NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];

MyViewController *viewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:bundle];

[self.navigationController pushViewController:viewController animated:YES];

Yes, it’s that simple, that obvious, though it’s not listed anywhere. I believe to be prudent and convenient to write about it in order to help anyone who encounter themselves in the same situation as I did.