Launch Xib file from ViewController and perform action on Xib in iOS.

Updated 26 October 2021


Launch Xib file

Sometimes we need to show the UIview over view controller  for that we can use xib file to pop over any view controller and we can add any action on the xib file .

Here I have taken the example of a xib file where I have attached the button, label on xib file after clicking on it, it will remove and fetch the value whatever you passed.

follow some steps:

1: Take one Xib file  .

2: Take one UILabel and one UIButton over it.

3: Take one cococatouch class file and their parent would be UIViewcontroller. ( Name as : abc.m,abc.h file)

4: Open Xib file and click on files’owner and on right side (Custome class) write file name ex: abc.m

5: Select the files’s owner click on ” Connection inspector” here you have to drag the UIView to View.

6: Now select View and drag the reference of UIButton , UILabel in abc.h class.

7: Write the abc.h file as

8: write abc.m file as

9: Its time to call that xib file and fetch their data .

Note: here you have to call from any viewController class.

10 : write their delegate method so we can access their value.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home