xcode - Nesting XIBs in Interface Builder / embedding by reference -


say have created xib icon view. want embed number of instances of icon view in different xib container view by reference, if alter properties / layout in original icon view xib, instances in container view xib reflect these changes.

essentially, embedding reference.

maybe i'm being dense, seems default behaviour of interface builder when dragging view container view copy over, rather referencing original xib? , dragging instance of class associated icon view container view results in blank view.

i'm sure there's way this, i'm damned if can figure out. avoid ib plague ;)

there isn't way of doing directly in interface builder. needed similar in last app. ended doing placing placeholder view in location want referenced xib , in viewdidload or viewwillappear, etc, load xib , place loaded view child of placeholder view.

nsarray *views = [[nsbundle mainbundle] loadnibnamed: @"referencedview" owner: self options: nil]; uiview *referencedview = (uiview *)[views objectatindex:0]; [self.viewplaceholder addsubview:referencedview]; 

alternatively, can create iboutlet in view controller hold referenced view , connect outlet in ib. if do, won't need pull view out of nsarray.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -