NIB loading with objects from a static library
NIB loading with objects from a static library
- Subject: NIB loading with objects from a static library
- From: Roland King <email@hidden>
- Date: Sun, 9 Jan 2011 18:53:11 +0800
I just finished writing a chuck of code for IOS which implements a UIView subclass, it's quite generic, I'm going to want to use it everywhere and so I put it into a static library in a different target in my project, then imported and linked against that static library. The targets build ok and I can see the link phase, so that's great.
However my test project has a NIB created in IB which contains an instance of this view, call it RDKView. When the NIB loads it doesn't find RDKView and creates a normal UIView instead, that of course doesn't work. I'm assuming that this is because only the methods used in my test code are linked, and that doesn't include the methods the NIB loading system needs to make one, so it falls back to making UIView and fails later.
I have found, by googling, that if I put the following line in before the NIB loads, that's enough to drag enough of the class in for the NIB loader to use it.
[ RDKView class ];
I'd sort of rather not have to do that in every project I write which uses this static library, because I'll forget and spend 2 days trying to figure it out. Is there a way to make the static library such when it links it includes all methods or some other way not to have to put this method call in or is this just a price you pay for using IB with static libraries?
Supplementary question, how can I see what methods are being imported into my final binary from the static library, I'm interested to know how just adding one class method like that causes the linker to pull in the rest.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden