-
Notifications
You must be signed in to change notification settings - Fork 344
How to use
To use this classes in your project:
- Include the "OHAttributedLabel.xcodeproj" in your Xcode4 workspace
- Add the
libOHAttributedLabel.a
library and theCoreText.framework
to your "Link binary with libraries" Build Phase. - Add the
-ObjC
flag in the "Other Linker Flags" build settings if not present already(*)
Then in your application code, when you want to make use of OHAttributedLabel methods, import the headers using the angle brackets syntax : #import <OHAttributedLabel/OHAttributedLabel.h>
or #import <OHAttributedLabel/NSAttributedString+Attributes.h>
etc.
(*) Note: If you use an Xcode version prior to 4.2 (and LLVM version prior to 3.0), you will need to add 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. Updating your Xcode version is strongly recommended
If the compiler has trouble importing your <OHAttributedLabel/OHAttributedLabel.h>
headers, this is probably because it can't find the right path the headers and the generated library are copied. This can append if you don't use some standard Xcode configuration, or if your application project uses configurations named other than the standard "Debug" and "Release".
In that case, you will need to specify explicitly the "Header Search Path" and "Library Search Path" in your application's Build Settings:
- In your "Header Search Path" setting of your application project:
- add
"$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)/include"
for all the configurations - except for the configuration you use for Archiving where you should specify
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)/include"
.
- add
- In your "Library Search Path" setting of your application project:
- add
"$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)"
for all the configurations - except for the configuration you use for Archiving where you should specify
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)"
- add
Note: don't forget the quotes around the above settings.
This distinction is because the OHAttributedLabel project builds the "Debug" version of the library in every Build action (Build, Run, Test) of its Xcode scheme, except for the "Archive" action for which it builds the "Release" version. If you change the scheme configuration of
OHAttributedLabel.xcodeproj
be sure to use matching search paths according to the configurations used for each case.
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.