这是我以编程方式创建按钮的代码:
NSArray *buttonImage=[NSArray arrayWithObjects:[UIImage imageNamed:@"Cover_0.png"],
[UIImage imageNamed:@"Cover_1.png"],
[UIImage imageNamed:@"Cover_2.png"],
[UIImage imageNamed:@"Cover_3.png"],
[UIImage imageNamed:@"Cover_4.png"],
[UIImage imageNamed:@"Cover_5.png"],
[UIImage imageNamed:@"Cover_6.png"],
[UIImage imageNamed:@"Cover_7.png"],nil];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 200.0f, 200.0f);
[button setTitle:[NSString stringWithFormat:@"%i", index] forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
button.titleLabel.font = [button.titleLabel.font fontWithSize:50];
[button setImage:buttonImage forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
return button;
但是在运行它时,我无法进入模拟器并且它会抛出 Signal Sigabart 错误。任何人都可以帮忙吗?