ios - 使用转发类时未找到属性

时间:2013-05-08 14:02:12

标签: ios objective-c properties vuforia

我正在尝试在现有项目中实现VuforiaSDK并遇到此问题:我无法访问作为UIView类的子类型的对象的自定义属性和方法。似乎我只能使用UIView属性,而不能使用我自己的属性。

以下是我的一些代码:

EAGLView.h

#import "AR_EAGLView.h"

#define kQCARMarkerScanned              @"QCARMarkerScanned"

@interface EAGLView : AR_EAGLView
{

}

@property (nonatomic, retain) NSString *myVal;

- (id)blablaWithFrame:(CGRect)frame;

@end

EAGLView.mm

 #import "EAGLView.h"
 #import "Teapot.h"
 #import "Texture.h"

 #import <QCAR/Renderer.h>
 #import <QCAR/VideoBackgroundConfig.h>
 #import "QCARutils.h"
 ...


 @implementation EAGLView

 - (id)blablaWithFrame:(CGRect)frame
{
     NSLog(@"Bla bla enters..");

     return [self initWithFrame:frame];
}

- (id)initWithFrame:(CGRect)frame
{
     self = [super initWithFrame:frame];

     myVal = @"initWithFrame";

     if (self)
     {
       ...
      }
     return self;
 }

ARViewController.h

#import <UIKit/UIKit.h>
@class EAGLView, QCARutils;

@interface ARViewController : UIViewController {
@public
    IBOutlet EAGLView *arView;  // the Augmented Reality view
    CGSize arViewSize;          // required view size

@protected
    QCARutils *qUtils;          // QCAR utils singleton class
@private
UIView *parentView;         // Avoids unwanted interactions between UIViewController and EAGLView
NSMutableArray* textures;   // Teapot textures
BOOL arVisible;             // State of visibility of the view
}

 @property (nonatomic, retain) IBOutlet EAGLView *arView;
 @property (nonatomic) CGSize arViewSize;

 - (void) handleARViewRotation:(UIInterfaceOrientation)interfaceOrientation;
 - (void)freeOpenGLESResources;

 @end

ARViewController.mm

#import <QuartzCore/QuartzCore.h>

#import "ARViewController.h"
#import "QCARutils.h"
#import "EAGLView.h"
#import "AR_EAGLView.h"
#import "Texture.h"

@interface ARViewController ()
- (void) unloadViewData;
- (void) handleARViewRotation:(UIInterfaceOrientation)interfaceOrientation;
@end

@implementation ARViewController

@synthesize arView;
@synthesize arViewSize;

...

- (void)loadView
{
     NSLog(@"ARVC: loadView");

     CGRect viewBounds;
     viewBounds.origin.x = 0;
     viewBounds.origin.y = 0;
     viewBounds.size.width = arViewSize.height;
     viewBounds.size.height = arViewSize.width;
     //arView = [[EAGLView alloc] initWithFrame: viewBounds]; // I have replaced this line
     arView = [[EAGLView alloc] blablaWithFrame:viewBounds]; // with this one - my custom method - gives error "Method blablaWithFrame is not a selector for EAGLView class"

     parentView = [[UIView alloc] initWithFrame: viewBounds];
     [parentView addSubview:arView];
     self.view = parentView;
 }


 - (void)viewDidLoad
 {
      NSLog(@"ARVC: viewDidLoad");

      NSLog(@"ARVIEW class = %@", [arView class]);

      if (textures == nil)
           textures=[qUtils loadTextures:arView.textureList]; // here occurs the error saying that textureList property doesn't exists
      [arView useTextures:textures];

      [qUtils createARofSize:arViewSize forDelegate:arView];
      arVisible = NO;
  }
每当我尝试访问arView对象的属性时,

..和“无法识别的选择器发送到实例”错误

我已经尝试过(差不多)一切......但仍然不知道是什么导致了它。如果有人知道我的项目中可能设置的某些设置,请帮忙!

谢谢!

0 个答案:

没有答案