How NOT fill arrays


- (NSMutableArray*) getButtonTitles
{
    NSMutableArray* buttonTitles = [[NSMutableArray alloc] initWithCapacity:4];
    for (NSInteger i = 0; i < (_itemCountSegmentController.selectedSegmentIndex + 1); i++)
    {
        switch (i) {
            case 0:
                buttonTitles[0] = @"One";
                break;
            case 1:
                buttonTitles[1] = @"Two";
                break;
            case 2:
                buttonTitles[2] = @"Three";
                break;
            case 3:
                buttonTitles[3] = @"Four";
                break;
            default:
                break;
        }
    }
    return buttonTitles;
}

Source : Pastebin