我是 iOS 开发的新手,当我按照教程进行操作时,我的应用程序继续崩溃,但我不明白为什么..
2012-11-07 11:52:30.657 SliderList[2725:c07] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 8 beyond bounds [0 .. 7]'
*** First throw call stack:
(0x1c8d012 0x10cae7e 0x1c42b44 0x2cb2 0x10de705 0x15920 0x158b8 0xd6671 0xd6bcf 0x15c52d 0xd5968 0x451bd 0x45552 0x233aa 0x14cf8 0x1be8df9 0x1be8ad0 0x1c02bf5 0x1c02962 0x1c33bb6 0x1c32f44 0x1c32e1b 0x1be77e3 0x1be7668 0x1265c 0x26bd 0x25e5 0x1)
libc++abi.dylib: terminate called throwing an exception
#import "ViewController.h"
NSArray *keuzeArray;
@interface ViewController ()
@end
@implementation ViewController
@synthesize keuze;
- (IBAction)sliderValueChanged: (UISlider *)sender
{
self.keuze.text = [keuzeArray objectAtIndex:sender.value];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
keuzeArray = [NSArray arrayWithObjects:
@"Koffie zwart", @"Koffie melk", @"Koffie melk&suiker", @"cafe au lait", @"Koud water", @"Heet water", @"Chocomel", @"Wiener melange", nil];
}
- (void) viewDidUnload
{
[super viewDidUnload];
}
- (BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)InterfaceOrientation
{
return (InterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end