Question

I've got a class and xib that are fairly generic. The xib has a base UI that I've included in a framework. Is it possible for me to add the framework to a project, and create a custom xib to customize my framework xib based on the new project UI needs?

|------------------------|
|   MyFrameworkClass     |     MyCustomXib
|   MyFrameworkXib       | 
|------------------------|

In MyCustomXib i've set the custom class of the files owner to MyFrameworkClass. I notice that I can wire up all my IBOutlets by right clicking on file's owner and dragging to the subviews to make the connections, however I cannot click on the view and drag to file's owner. Also When I go into split view mode I'm not seeing MyFrameworkClass as the code side of the split view?

Right now i'm trying to initialize it with:

MyFrameworkClass *mfc = [MyFrameworkClass alloc] initWithNibName:@"MyCustomXib" bundle:nil];

I'm confused because I'm seeing labels that are created dynamically in MyFramework class showing up in the custom UI, also newly modified button images are replacing old ones, however the buttons are not responding to touches, and the xib resizing is not working correctly.

Edit:

I just went through and compared the xib in the framework and my custom one and found that I could connect all my Outlets to the proper UI elements, however I could not connect any received actions using interface builder. By that I mean when I ctrl+click on a button and drag the connector up to File's Owner, I do not get the glow around File's Owner or a prompt to connect to any methods.

Was it helpful?

Solution

Yes. As long as the class is loaded into the runtime when the XIB file is read, it will work perfectly fine.

It will work. :-) Post additional details of what you mean by "framework" if it doesn't.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top