May 23, 2011
In my previous post I demonstrated how to quickly whip up some lazy loading for a UIImageView. Today I revamped it to use NSURLConnection instead, because this would allow for cancelling the request. It also gives us the option of specifying if we want to make use of the cache and also how long we’re actually willing to wait for an answer.
That sounds more straightforward than it actually is. If you simply use an NSURLConnection with its delegate methods then you might not see anything wrong, unless you are using this lazy image view as subview of a UIScrollView. The problem there is that the scroll view blocks the run loop and so your connection events will not get delivered until you lift the finger.
But I found a solution for that. Let me know in the comments if you think something could be done in a more elegant way. The code for this is available in the NSAttributedString+HTML project.
May 20, 2011
In case you ever need to enhance UIImageView to load it’s image lazily… like if it’s coming from a web URL.
I used this on my NSAttributedStrings+HTML open source project to improve performance and also be able to have images that are not available locally. But you don’t want to do a synchronous call over the web, that would block your UI.
I admit, it’s a quickie, but hey, sometimes those are also fun!
May 19, 2011
This topic is not for the faint of heart because it requires that you permit an additional level of abstraction in your brain to be able to grasp it. Until know all my ivars and properties where either scalar values (like an NSInteger) or pointers to Objective-C instances (like NSString *). But there are cases when you actually want to be able to store more complex functionality yet not have the overhead of object creation and messaging.
From the C days we have a mechanism called “function pointers” and today I’ll show you how you can pass a function itself to an Obj-C class and store it in an instance variable. There are a couple of SDK functions that make use of that.
The we’ll explore the modern-day equivalent of providing this sort of “plug in” dynamic functionality: doing the same thing with blocks. If you’re lucky to have iOS 4.x as minimum requirement for your project then those blocks might be nicer to work with than function pointers.
May 18, 2011
Daniel Wood asked:
Considering making a Blockees universal. What are people’s thoughts on universal apps? Good for users, but splits sales between devices.
My first gut response was, that IMHO users love universal apps, whereas marketeers and financiers hate them. HD or “for iPad” versions can generally be sold for a higher price.
Daniel then voiced his fear that if you have an universal app you might “dilute” your download rank on iTunes. Again I responded from my feeling that I don’t think that this is right. Daniel challenged me to prove it. And so I will.
May 18, 2011
I asked the Twitterverse the following question:
iOS Developers: Coffee or Green Tea?
I was only half-expecting useful responses. But since I got 23 answers, I figured I might as well tabulate them.
May 18, 2011
René Lindhorst attended the MobileTech Conference in Munich in April. He snapped this picture of a slide stating “we use our phones to manage every aspect of our lifes”. You can tell that this conference was in Germany due to the misspelling of “lives”. 🙂
I still love that they chose our new 2.0 iWoman icon top left, as indeed my wife (and many other humans of the female persuasion) use iWoman to manage a very important part of their lives. And thanks for putting it in good company: I see Pages, Evernote, Carcassonne and Angry Birds there, all apps that I also have installed, too.
May 15, 2011
When you are looking for ways to increase exposure to your site or apps you have a plethora of options of holes that you can pour money in to. I found that milage varies enormously.
Google AdWords wanted me to have another look at their offering and gave me a credit for 100 Euros to spend on their ad network. At the same time I put exactly the same banner ad on 3 sites that I found when browsing the BuySellAds list of publishers. Also I’ve had several customers for putting ads on the Cocoanetics site, one app, and three ads for two components.
Let’s have a look at the numbers to see if we cannot figure out some feel for the varying effectiveness.
May 13, 2011
When I saw this creative job advert I figured, why not pull together the most interesting iOS jobs into an article. I keep telling you that more companies are hiring than there are iOS software engineers looking to be hired. Now here’s the proof.
I was contemplating several forms of establishing a platform that you could refer to. Should I put it on a dedicated Jobs page on Cocoapedia? Make a jobs page on this here blog? Write about it?
All of the above. So far 7 companies have sent me links to their job specifications. Since this is a large enough first sample to call that “many companies” here’s a quick rundown and commentary on the jobs.
May 12, 2011
Ever since I got my first earbuds with an Apple device (must have been an original iPhone) I’ve been wondering something, maybe you as well: what is the purpose of this extra clip on the wire. There’s this movable thingy between where the cable parts and the earpiece.
In fact if you google that, then there’s only one other person that asks the same question:
On my iPhone headset (the one that came with the device, as well as the in-ear buds) there’s a little piece of plastic that slides on the cable to one earbud, and can clip onto the other cable.
- It’s not large enough to accommodate the headset cable below the split, so it can’t be used to somehow hold the cable in place when it’s curled up.
- It’s not tight enough to stay in place if I slide it nearer the earbud, so it can’t be used to essentially move the point where the cable splits closer to the earbuds.
- It’s not tight enough to really hold on to the other earbud cable. It takes nearly no effort at all to pull the cables apart.
What in the world is it good for?!?
After some research we found what it is mean to be used for, as well as several other tricks with Apple cables that you might not have known.