Siva
Siva

Reputation: 608

copy the xib from one project to another project

I need to copy xib files from one project to another project. This may be basic thing but I am new to xib file usage.

I manually copied the xxx.h, xxx.m & xxx.xib from project-1 and kept in one folder and included them in another project as "Right click on the Project-2 folder -> Add files to Project-2" option.

(1) I lost some IBOutlet connections after copying

(2) Xib not allowing to have new IBOutlet variables.

Then I copied the files from original location (Project-1 folder) but then

(3) If I create new IBOutlet connections the reference variable if I access I am getting nil value.

Could somebody help me the basics of how to move/copy the xib files and its sources.

Upvotes: 2

Views: 1505

Answers (3)

rohan-patel
rohan-patel

Reputation: 5782

There may be two issues I sense in your copying.

1) While you are copying check option : "Copy selected items to destination folder". refer screenshot!enter image description here

2) Also in your .xib file select File's owner --> Go to Identity Inspector in right top corner and select suitable class for that xib. When you add xib independently you have to set it's class manually like this.

enter image description here

Upvotes: 3

Midhun MP
Midhun MP

Reputation: 107231

When copying you need to setup the class and outlet connections.

Follow these steps:

  1. Copy the xib
  2. Add the class name of your xib in it's files owner

Class

  1. Add the outlets

Outlets

Upvotes: 1

Sudha Tiwari
Sudha Tiwari

Reputation: 2461

May be it will help you.... Click your .xib file and add the class name. Like thisenter image description here

Upvotes: 2

Related Questions