将StoryBoard与ZBARReaderView一起使用时看不到IBOUTLETs [英] Can't see IBOUTLETs when using StoryBoard with ZBARReaderView

查看:104
本文介绍了将StoryBoard与ZBARReaderView一起使用时看不到IBOUTLETs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用情节提要而不是NIB文件在ZBar SDK中编写嵌入式阅读器示例.我这样声明我的IBOutlets:

I am trying to write the embedded reader example in ZBar SDK using a story board and not NIB files. I Declare my IBOutlets as so:

@interface MYQViewController : UIViewController < ZBarReaderViewDelegate >
{
    ZBarReaderView *readerView;
    UITextView *resultText;
}
@property (strong, nonatomic) IBOutlet ZBarReaderView *readerView;
@property (strong, nonatomic) IBOutlet UITextView *resultText;
@end

但是,当我在主UIView上创建一个ZBarReaderView视图控制器并尝试单击并拖动以连接readerView作为参考插座时,我只是不知道如何连接它.我从主要ViewController获得的只是一个选择view的选项.

However when I create a ZBarReaderView View Controller on the main UIView and try click and drag to connect readerView as a referencing outlet, I just can't figure out how to connect it. All I get from the primary ViewController is an option to select view.

推荐答案

将一个UIViewController添加到您的Storyboard.

Add a UIViewController to your Storyboard.

将UIView添加到UIViewController,现在您将具有UINavigationController> UIView> UIView.给子UIView指定您希望阅读器区域的大小.

Add a UIView to the UIViewController, now you will have a UINavigationController > UIView > UIView. Give the child UIView the size you expect the reader area to be.

创建类型为UINavigationController的类,并将以下代码添加到接口中.

Create a class of type UINavigationController and add the following code to the interface.

@property (nonatomic, strong) ZBarReaderView* readerView;
@property (nonatomic, strong) IBOutlet UIView* skeletonView;

将以下代码添加到实现中.

Add the following code to the implementation.

@synthesize skeletonView;
@synthesize readerView;

- (void)viewDidLoad {

    self.readerView = [ZBarReaderView new];
    self.readerView.readerDelegate = self;
    self.readerView.zoom = 1;

    self.readerView.frame = CGRectMake(0, 0, self.skeletonView.frame.size.width, self.skeletonView.frame.size.height);
    [self.skeletonView addSubview:readerView];
    [self.skeletonView sendSubviewToBack:readerView];
    [self.readerView start];

}

将UINavigationController类设置为您创建的类.

Set the UINavigationController class to the class that you have created.

将子UIView连接到UIView IBOutlet.

Connect the child UIView to the UIView IBOutlet.

您已被读懂了,这样做无需进行任何黑客操作,并且可以使用按钮和消息来自定义子视图.

You are read to go and by doing that you don't need to hack anything and you can customize the child view with buttons and messages.

这篇关于将StoryBoard与ZBARReaderView一起使用时看不到IBOUTLETs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆