私はIBOutletCollection(UIbutton)
-(void)initButtons{
buttons = [[NSMutableArray alloc] initWithCapacity:1];
UIButton *myBut = [UIButton alloc];
[buttons addObject: myBut];
[[buttons objectAtIndex:0] addtarget:self [email protected](play:) forControlEventTouchUpInside];
}
...
-(void)dealloc{
[buttons dealloc];
[super deallloc];
}
を持っている.....
-(void)viewDidLoad{
[super viewDidLoad];
[self initButtons];
}
インターフェースビルダーのボタンIBoutletCollectionを単純なボタンにドラッグしましたが、テストすると、期待されるアクションは実行されません。
(void)の代わりにアクションを(IBAction)に変えてボタンにリンクすると言います。
NSArraysとアウトレットのコレクションはよく分かりません。
あなたの 'dealloc'メソッドが間違っています。自分自身でdeallocを呼び出すことは絶対にしないでください( 'super'に中継することを除く)。代わりに '[buttons releases]'を呼び出してください。 – SK9