StoryBoard で ViewController を作成し、それを GamePanelViewController クラスにリンクしました。さらに、ViewController のビューを、UIView を拡張する GamePanel という 2 番目のクラスにリンクしました。
StoryBoard によって自動的に作成されたビューにアクセスして、ID インスペクターによってビューにリンクされている GamePanel クラスに実装したいくつかのメソッドを実行するにはどうすればよいですか?
GamePanel.h:
#import <UIKit/UIKit.h>
#import "Plattform.h"
@interface GamePanel : UIView
@property (strong, nonatomic) NSMutableArray *plattforms;
- (void)initGamePanel;
- (void)drawPlattforms:(CGContextRef)gc;
@end
GamePanel.m:
#import "GamePanel.h"
@implementation GamePanel
@synthesize plattforms;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
- (void)initGamePanel{
self.backgroundColor = [UIColor redColor];
self.plattforms = [NSMutableArray new];
// Initialization code
for(int i = 0;i<8;i++){
for(int j = 0;j<6;j++){
[self.plattforms addObject:[[Plattform alloc] initWithXCord:(14+j*37) andYCoord:(58+14+i*37)]];
NSLog(@"Init");
}
}
}