A few weeks ago someone posted a pretty interesting question on SO and I decided to have a crack to see how far I could get. In a nutshell, the OP was looking for an efficient way of finding and replacing URLs in an NSString, and possible use the same method to filter out rude […]
Archive | Code Snippets
RSS feed for this sectionHow-to: capture touches on the iPhone status bar
Not many users are aware of it, but if you tap the status bar when scrolling through tableviews, scrollviews and webviews, the device will automatically scroll your view all the way back to the top. This is a very convenient piece of functionality when browsing long, vertical pages, or scrolling through tableviews with a large […]
Code snippet: how to get a screenshot of a UIView
Here’s something that could be useful if you’re trying to find a simple way of passing any UIView (and its subviews) as a UIImage – literally taking a screenshot of whatever is on that view: Found and slightly adapted from here [objc] + (UIImage *)captureView:(UIView *)view withArea:(CGRect)screenRect { UIGraphicsBeginImageContext(screenRect.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[UIColor blackColor] […]
MapKit: tap and hold to drop a pin on the map
Not many people are aware of this but the Maps app on the iPhone and iPad allows you to tap and hold to drop an annotation/pin on the map. Once the pin is dropped the App uses reverse geocoding (available with MapKit – details here) to get location details for a specific coordinate. I’ve been […]