Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interface Builder can't see classes in a static library

I have refactored some UIView sub-classes into a static library. However, when using Interface Builder to create view components for a project that uses the static library I find that it is unaware of the library classes. What do I need to do to make the class interfaces visible to Interface Builder?

Update: The correct answer refers to dragging the headers into the 'XIB browser'. The '.h' files can be dragged from a finder window to the window area identified in this image:

alt text http://img211.imageshack.us/img211/1221/xibbrowser.png

like image 259
teabot Avatar asked Jun 29 '09 14:06

teabot


4 Answers

Try dragging the static library into your xib browser in Interface Builder. I haven't tried this with a static library, but the concept is the same. When you drag header files into IB, you can access those classes.

like image 116
Reed Olsen Avatar answered Nov 18 '22 10:11

Reed Olsen


LexH, try linking with the -ObjC flag when building your static library. That worked for me... for about a year :-) I found this post as the problem has returned with a fresh OSX install and an upgrade in xcode. But it worked in XCode 3.1.2.

  • David
like image 34
Dave Avatar answered Nov 18 '22 09:11

Dave


Add the same problem as LexH. It worked only when I called a dummy class method. The problem was that I did not add my static library to the "link binary with libraries" under target. Strangely everything else worked.

I followed this guide to link with my static lib Create static lib

like image 1
CodeFlakes Avatar answered Nov 18 '22 11:11

CodeFlakes


I had the same problem. Dragging the library or headers to XIB Browser didn't work. Read Class Files didn't work. So I called:

[MyLibraryClass version];    // Substitute your class name for "MyLibraryClass".

This worked. version is a class method of NSObject, so all subclasses of NSObject inherit it.

like image 1
Michael Hourigan Avatar answered Nov 18 '22 10:11

Michael Hourigan