Press "Enter" to skip to content

Chris Mills Posts

JavaScript Frustum View Culling Performance

At work the other day a buddy (+Chris Lentini) wrote a simple little JavaScript frustum culling program, checking 16384 spheres. On an aside, check out his very cool River Trail post based on this same starting code. Also I’d like to point out that this code was not meant to be elegant, or for high performance, just to get a basic idea for something he was working. Even with that, what peaked my interest though was the difference in timing between Chrome v13 and Firefox 6.0.2. My first guess was that the function calling was killing it and taking most of…

Continue reading JavaScript Frustum View Culling Performance

UIView Drop Shadow with Rounded Corners

Looking up a completely separate problem, I was running across a considerable amount of people asking how to apply a drop shadow to a UIView or how to round the corners. I previously did a post on something similar, but I wanted to take the time and build a small demo that shows how to accomplish both these things in a very easy way. Essentially we’re going to use the CALayer in the UIView to do all the work for us and not even bother with renderInContext:UIGraphicsGetCurrentContext(). Suppose we have a view we want to round and apply a drop shadow to…

Continue reading UIView Drop Shadow with Rounded Corners

Making a PDF from a UIWebView

Update – If Brent Nycum made a great little helper class to make printing PDFs from WebViews easy. Check it out over on GitHub While working on a project I needed a way to generate a pdf from some in app html to a for emailing and printing purposes. This seemed like a rather easy task, however the pdf generated was always empty. After digging around the web I kept coming back to this post on StackOverflow. A bit more searching I came across this great post by Brent Nycum which became my starting point. As Brent points out, this…

Continue reading Making a PDF from a UIWebView

Basic Delegate Example

There are two things that I have recently grown to love when it comes to writing iOS code and those are Protocols and Delegates. If you written anything with a UITableView in it , then you’ve used Protocols before. For instance, cellForRowAtIndexPath is in fact a method that is defined in the UITableViewDataSource protocol. You’ve been using protocols this whole time and didn’t even know it, or maybe you did. So how do you make your own Protocol and Delegates? It’s actually fairly boilerplate and super simple. Here is a simple example. Definition [sourcecode language=”objc”] #import <Foundation/Foundation.h> @protocol MyClassDelegate <NSObject>…

Continue reading Basic Delegate Example

Goodbye Tumblr

It’s finally happened, I’ve left Tumblr. In the past few months I’ve left SquareSpace and now Tumblr for WordPress. I think each of these services fill a niche that really helps everyone find the service that’s right for them. I see them working like this, Tumblr: Small quick posts, almost like Twitter but with no character limit. More about sharing than blogging. WordPress (no custom server): Fantastic blogging engine. Though you can have multiple pages, I feel without your own server it’s more geared towards just blogging, not having a full site. If you want to blog with some pretty…

Continue reading Goodbye Tumblr

UIGraphicsGetCurrentContext() Performance

In an app I’m currently working on I had two choices, either make 135 small thumbnail images or I auto-generate them by flattening the UIView into a single UIImage then use that as the background the UIButton. Having never done this, I figured it would be a great chance to learn. I’m not even going to consider making it a UILabel (title), UIImageView (icon), UIImageView (shadow), UIButton (actual hidden button) as scrolling through the 135 buttons would be unbearable. My first attempt was very naive and rather brute force-ish since I was doing this for each of the 135 buttons. Also…

Continue reading UIGraphicsGetCurrentContext() Performance