UIButtonを作成する「Menu」という名前のクラスが1つあります。
.h ファイル:
@interface Menu : NSObject
@property (strong) Forme *forme;
@property (strong) NSString *imageButtonName;
@property (strong) UIButton *button;
- (id) initWithClef:(int)clef hauteur:(int)hauteur largeur:(int)largeur posY:(int)posY posX:(int)posX alpha:(float)alpha imageButtonName:(NSString*)imageButtonName button:(UIButton*)button;
@end
.m ファイル:
#import "Menu.h"
@implementation Menu
@synthesize forme = _forme;
@synthesize button = _button;
@synthesize imageButtonName = _imageButtonName;
- (id) initWithClef:(int)clef hauteur:(int)hauteur largeur:(int)largeur posY:(int)posY posX:(int)posX alpha:(float)alpha imageButtonName:(NSString *)imageButtonName button:(UIButton *)button
{
if ((self = [super init]))
{
NSLog (@"test2");
self.forme =[[Forme alloc]initWithClef:clef hauteur:hauteur largeur:largeur posY:posY posX:posX alpha:alpha];
self.button = button;
[button setFrame:CGRectMake(largeur, hauteur, posX, posY)];
[button setBackgroundImage:[UIImage imageNamed:imageButtonName] forState:UIControlStateNormal];
}
return self;
}
作成したボタンをViewControllerビューに自動表示したい。誰かが私を助けてくれますか?