简体   繁体   中英

has set the IBOutlet by code but can not see outlets

MyView.m code is

#import <UIKit/UIKit.h>

@interface MyView : UIView
{

}

@property (strong, nonatomic)IBOutlet UILabel *aLabel;

but when I open the xib file MyView.xib relates to MyView.h/MyView.m(has set the file owner as Myview, I can not see the IBOutlet aLabel

Is there a way can make UIView also can show IBOutlet aLabel, just like an UIViewController does?

Your comment welcome

在此处输入图片说明

Check your Outlets in your view not under the file's owner. See the screenshot.

在此处输入图片说明

在此处输入图片说明

First, your object is sub-class of UIView, which isn't can be natively relate to a xib. You should use UIViewController instead.

2nd. In case of you want to use an UIView in a xib, here is the way you can have it:

  1. open your xib, click in the view that you want to turn it as your class.
  2. open the right-side menu, and select the 3rd tab.
  3. fill "class" field as your class name.
  4. and now you can right click to the view and see your IBOutlet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM