It's because in - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
, you're adding 1 to the result you return. So your stepLabel
array has 5 elements (which are at indexes 0 - 4). But when you add 1 to that number, then your code thinks you have 6 rows, which are at indexes 0 - 5. So your - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
method tries to access data from index 5 of an array that only has 5 elements (hence, ends at index 4).
You could make the following change to your code to fix this crash:
cell.stepTextLbl.text = [stepLabel objectAtIndex:indexPath.row-1];
I think that will accomplish what you're trying, because it looks like it only goes into this part of your code if the row is greater than 0. So this shifts the values down by 1, so that you're accessing your array with indices from 0 - 4.