Я в основном хочу использовать PlacardView.m и PlacardView.h из примера Apple MoveMe, добавив его в качестве подпредставления на моем основном BlowViewController
PlacardView.m
#import "PlacardView.h"
@implementation PlacardView
@synthesize placardImage;
- (id)init {
// Retrieve the image for the view and determine its size
UIImage *image = [UIImage imageNamed:@"Placard.png"];
CGRect frame = CGRectMake(0, 0, image.size.width, image.size.height);
// Set self's frame to encompass the image
self = [self initWithFrame:frame];
if (self) {
self.opaque = NO;
placardImage = image;
}
return self;
}
- (void)dealloc {
[placardImage release];
[super dealloc];
}
@end
PlacardView.h
@interface PlacardView : UIView {
UIImage *placardImage;
}
@property (nonatomic, retain) UIImage *placardImage;
// Initializer for this object
- (id)init;
@end
Это мой MicBlowViewController.h
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
@class PlacardView;
@interface MicBlowViewController : UIViewController {
AVAudioRecorder *recorder;
NSTimer *levelTimer;
double lowPassResults;
PlacardView *placardView;
}
@property(nonatomic, retain) PlacardView *placardView;
- (void)setUpPlacardView;
- (void)levelTimerCallback:(NSTimer *)timer;
@end
Это частичный MicBlowViewController.m .. есть функция viewDidLoad, но она не имеет ничего общего с представлениями.. это просто таймер для записи звука, поэтому я не вставляю, что
#import "MicBlowViewController.h"
#import "PlacardView.h"
@implementation MicBlowViewController
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setUpPlacardView];
}
return self;
}
- (void)setUpPlacardView {
// Create the placard view -- its init method calculates its frame based on its image
PlacardView *aPlacardView = [[PlacardView alloc] init];
self.placardView = aPlacardView;
[aPlacardView release];
placardView.center = self.center;
[self addSubview:placardView];
}
Я получаю ошибку "Свойство 'center" не найдено для объекта типа "MicBlowViewController *" "
Пожалуйста помоги.