• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iPhone app with searchable text that highlights
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone app with searchable text that highlights


  • Subject: Re: iPhone app with searchable text that highlights
  • From: Conrad Shultz <email@hidden>
  • Date: Fri, 13 Aug 2010 13:43:37 -0700

On Aug 12, 2010, at 17:31, Jonathan Schmidt <email@hidden> wrote:

> At its most basic level, I am creating an iPhone app that displays textual information.  When searching, I want the app to highlight the matching text.  I'm using Core Data with SQLite.  The text is stored in a string attribute right now.  The strings can be up to a few kilobytes in size.
>
> I think I need to use the web view to do this?  Anyone know of any sample code out there that can do this?
>

You don't say where you are planning to display the results. If you are intending to use the result in a UITableView, I think you can throw out the UIWebView approach... there seems to be an inevitable loading delay with UIWebView that becomes a major nuisance in a scrolling table. Furthermore you run into a problem returning proper values in the UITableView heightForRowAtIndexPath: delegate method - your UIWebView won't have loaded by the time the row height is requested.

If you are not displaying in a UITableView these problems are less severe to non-existent, and it becomes a simple matter of rendering out HTML with loadHTMLString: or the like.

We have an app with very similar behavior that was designed before Core Text became available. I ended up writing my own custom view code that composites text and background views, with pixel-precise positioning courtesy of the various string size methods furnished by the UIKit additions to NSString. If I had to do it over, though, I would learn to use Core Text; my current approach is rather inelegant.

If you want a quick, albeit clumsy, approach you might look at the TTStyle stuff in the three20 framework. But this is almost certainly not the best long term solution.

--
Conrad Shultz
www.synthetiqsolutions.com_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • RE: iPhone app with searchable text that highlights
      • From: Jonathan Schmidt <email@hidden>
References: 
 >iPhone app with searchable text that highlights (From: Jonathan Schmidt <email@hidden>)

  • Prev by Date: SMTP Framework for Cocoa
  • Next by Date: Re: How to assure NSTask termination when parent dies
  • Previous by thread: iPhone app with searchable text that highlights
  • Next by thread: RE: iPhone app with searchable text that highlights
  • Index(es):
    • Date
    • Thread