Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are *.xib, *.m and *.h files related?

How/where in the code does the nib file get related to its *.m and *.h files?

Specifically I'm talking about when you create a new Objective-C class, not using the initWithNibName method.

Wherever this relationship is defined is obviously used by the 'Files Owner' relationship in Interface Builder. I imagine it's a *.plist file somewhere or something.

like image 862
conorgriffin Avatar asked Jan 20 '26 10:01

conorgriffin


1 Answers

NIB files describe classes instances.

When you drag and drop a component in a NIB with Interface Builder, actually, you create an instance.

If you drag and drop a UIViewController for instance, and if you did define a subclass of UIViewController in your OWN classes with a .m and a .h, you'll be able to say to interface builder : "use my custom subclass of UIViewController for this object instance".

This is achieved in interface builder with Tools/Identity Inspector and then Class identity : at this place, you can put your own classes that indirectly refer to your own .h and .m

like image 170
yonel Avatar answered Jan 22 '26 05:01

yonel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!