Search code examples
iosobjective-cinterface-builderiboutlet

On Interface Builder connect UILabel to custom UIView IBOutlet


I'm developing an iOS app with latest SDK.

I have created a custom class:

#import <UIKit/UIKit.h>

@interface UICustomView : UIView
{
    @private
    int _counter;
}

@property (nonatomic, weak) IBOutlet UILabel* textField;

@end

On Storyboad I have added a UIView and changed its class to UICustomView. To this UIView I have added an UILabel using Interface Builder but now I don't know how to connect this UILabel with the IBOutlet on the custom view.

Do you know how can I do it?


Solution

  • New approach (which I've tested)

    Select your UICustomView in Interface builder and you should see your UILabel in the inspector to the right under "Outlets". Drag that to your label to connect it.

    enter image description here