0

I'm sure this might be fairly easy but I'm unable to do it. I have a custom View xib customView.xib

and on basis of either segment selection I want to show one of my two tableViews. When tableView xib is loaded with

    _userProfileView = [[[NSBundle mainBundle] loadNibNamed:@"UserProfile" owner:_userProfileView

                                                        options:nil]firstObject];

tableViewDataSource and Delegate methods are called on CustomView not on UserProfileView.

Am I missing something here ?

Misha
  • 685
  • 8
  • 20
  • yes, they are called on View because you have placed table view inside of CustomView. – darshan Jun 22 '15 at 07:25
  • if you want they are called on UserProfileView then create new Protocol in CustomView and set its delegate from UserProfileView. check http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c?lq=1 for creating delegates. – darshan Jun 22 '15 at 07:27
  • @darshan thanks I'll give it a try – Misha Jun 22 '15 at 08:56
  • @darshan UserProfileView has button on it. So button action should be placed in customVew.m or UserProfileView.m ? – Misha Jun 23 '15 at 10:25
  • You should set button action in view where it is placed so it will be in UserProfileView.m – darshan Jun 23 '15 at 10:32
  • @darshan I'm pretty new to all of this so is it the right approach to place button action in UserProfileView and tableViewDatasource and Delegate methos in CustomView ? and could u please write it as answer to I can accept it ? – Misha Jun 24 '15 at 04:54

0 Answers0