Skip to content
AliSoftware edited this page Sep 23, 2012 · 20 revisions

How to use OHAttributedLabel

How to use in your project

To use this classes in your project:

  • Include the "OHAttributedLabel.xcodeproj" in your Xcode4 workspace
  • Add the libOHAttributedLabel.a library and the CoreText.framework to your "Link binary with libraries" Build Phase.
  • Add "$(BUILT_PRODUCTS_DIR)" to the "User Header Search Path" build settings of your application project (so that you will be able to #import the header files of OHAttributedLabel, that are copied there when the library project is build).
  • Also add the -ObjC flag in the "Other Linker Flags" build settings(*)

(*) Note: If you use an Xcode version prior to 4.2 (and LLVM version prior to 3.0), you will need to add the -force_load "$(BUILT_PRODUCTS_DIR)/libOHAttributedLabel.a" flags too (or the -all_load flag) in addition to the -ObjC flag, for the category to be loaded from the library. This is due to a bug in LLVM which has been fixed in LLVM 3.0 / Xcode 4.2 since.

This project is compatible with both ARC and non-ARC projects. Besides, as it is included as a stand-alone library, the build settings of the library won't affect the build settings of your own application.

Sample code & Other documentation

There is no explicit docset or documentation of the class yet sorry (never had time to write one), but

  • The method names should be self-explanatory (hopefully) as I respect the standard ObjC naming conventions.
  • There are doxygen/javadoc-like documentation in the headers that should also help you describe the methods
  • The provided example should also demonstrate quite every typical usages — including justifying the text, dynamically changing the style/attributes of a range of text, adding custom links, make special links with a custom behavior (like catching @mention and #hashtags), and customizing the appearance/color of links.
Clone this wiki locally