How do I connect a IBOutlet to a UIView?

前端 未结 4 1223
无人及你
无人及你 2020-12-17 03:16

I\'m trying to switch views after an animation as seen:

[UIView beginAnimations: @\"Fade Out\" context:nil];
[UIView setAnimationDelay:1.0];
[UIView setAnima         


        
4条回答
  •  我在风中等你
    2020-12-17 03:33

    I am late to this. But let me post what I found out recently anyways.

    I have this situation :

    1) BaseViewController that contains MenuView(Custom UIView)

    2) MenuView contains menuTable which holds all the menu items

    3) On StoryBoard I have BaseViewController scene with MenuView and MenuTableView

    I could have IBOutlet reference to menuTable that we normally do by dragging the table on storyboard to the BaseViewController.h. But I want custom MenuView to be responsible for populating the MenuTable as a separation concern. In order to do that I need IBOutlet reference connection from MenuView.h to the menu table on storyboard.

    So this is what I did :

    1) First create IBOutlet property of the table in MenuView.h @property (weak,nonatomic) IBOutlet UITableView *menuTable;

    2) Once the property is created, there is a little circle just left side of the property declaration signifying that this is IBOutlet variable.

    3) Now with StoryBoard open and MenuView.h open in Assistant Editor in XCode, I can click on the circle and drag it to table on the storyboard. (Note: If I try drag the table from StoryBoard to MenuView.h , it doesn't let me to. Note sure why)

    That's it. Now I've made the IBOutlect connection from custom UiView to StoryBoard.

    Note : I am using XCode 7 and targeting iOS 7 and above devices. (If that makes any difference)

提交回复
热议问题