This is the code I'm using:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 50, 70)];
[self.view addSubview:button];
if (buttonArray == nil) {
buttonArray = [[NSMutableArray alloc] init];
}
[buttonArray addObject:button];
[button release];
The butting isn't displaying, however. Any ideas why?
You're initializing it wrong. Try the following:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(100, 200, 50, 70);
[self.view addSubview:button];
if (buttonArray == nil) {
buttonArray = [[NSMutableArray alloc] init];
}
[buttonArray addObject:button];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With