Hans Pinckaers

KVO+Blocks

Just found out this little NSObject category. It’s awesome. A must #include in your project.

Read the rest of this entry »

Multi-line/Autoresizing UITextView similar to SMS-app

I’ve been tinkering around the last days, creating a multi-line UITextView. I wanted a SMS-app like experience and needed a growing (and shrinking) textView. I tried using three20′s TTTextEditor, but it disables the bounces of the scroll (which is ugly) and has this big white margin on the bottom when you scroll down manually. So I needed a UITextView which grows/shrinks with the text always on the bottom and a bouncing scroll. Well, I wouldn’t be blogging this if I wouldn’t have been succesful.
Read the rest of this entry »

Routes/Lines on a MKMapView
(as a MKAnnotationView) – Part 2.5

Download available after the jump.

First, I should credit Craig for his example of drawing lines on a MKMapView (http://spitzkoff.com/craig/?p=108), that’s where you can find part 1 and part 2. This post is a teaser of what I am going to post later this month. It’s a improvement on his code and makes overlays on a MKMapView possible without the need to hide it when zooming/panning around. Read the rest of this entry »

How to create a UITableViewCell with “copy” ability

It’s possible to copy the content of a UITableViewCell in the Contacts app of Apple. When you tap and hold you will see a small menu with “Copy”. I needed this functionality myself, so I subclassed the class. You are free to use this in any application, but it would be awesome if you mention me in the credits of your App. Read the rest of this entry »

Custom action on Back Button UINavigationController

Yes! There is a way of using the backBarButton with a custom action. No, it’s not by overriding the backBarButton property of navigationItem. This is not an ugly solution with images that simulate the “Back”-button (arrow-shaped.) It’s possible to use the backBarButton for popping the current viewController as normal, but than with other animations such as UIViewAnimationTransitionCurlDown. Read the rest of this entry »

High performance rounded corner UITableView

The problem with the previous example was that I was using a second UIScrollView to scroll the UITableView and not the UITableView itself, which is a subclass of UIScrollView and highly optimized for scrolling.

Here is a solution. The advantage of this one is that it is fast, but it’s not that easy and straightforward. Read the rest of this entry »

Reproducing a tableView like in Stocks/Spotlight/Weather

This article is outdated. You can find the better optimized tableView here: http://www.hanspinckaers.com/high-performance-rounded-corner-uitableview

To come straight out with it: the trick is

view.layer.cornerRadius = 10;

Read the rest of this entry »

Multiple NSURLRequests with different cookies (asynchronous)

I searched the whole internet for a solution but I didn’t find one. Yet I managed to get it to work. My problem was that I had several NSURLRequests who had to connect to one internet webservice, without an API, so I had to login behind the scenes with the provided login form from the normal website. This webpage uses cookies, but the NSURLRequest object on the iPhone uses a shared cookie storage. I wanted to use different accounts on one webservices with each their own cookies. Read the rest of this entry »

Multiple backgrounds with canvas drawing

The canvas HTML element was invented by Apple. It was created to dynamically create complex images for Widgets. There where a few complaints about the element, but despite of that it is included in the HTML 5.0 working draft. All modern browsers are compatible with the canvas-tag, beside of Internet Explorer, but Google created a superb piece of javascript that ported the canvas to IE. I created a little piece of javascript for drawing multiple backgrounds in a canvas element behind an HTML element. Read the rest of this entry »