Dec 07

Trawlr Ben has posted about his experience creating an iPhone optimised version of Trawlr with iUI and Rails 2.

He goes through the steps that he went through, which include:

  • Mime type: Mime::Type.register_alias “text/html”, :iphone
  • Detecting the iPhone: def iphone_user_agent?
  • Store whether it should be adjusted for iPhone adjust_format_for_iphone
  • Using iUI and creating iPhone views
  • Mr. TopFunky himself showed up to share his 80% solution for using layouts to generically support the iPhone without having to update views for each page:

    layout :determine_layout
    
    def determine_layout
      if mobile_safari_subdomain_or_relevant_header?
        return "iphone"
      end
    
      return "application"
    end