numberForRowsInsection account from to

advertisements

I parse an array into my TableView via JSON but I only want to make my table view show the first 18 things in this array. The array consists 72 objects and gets refreshed every day.

The objects in this array are named "0" - "71"...that doesn't change just the items assigned to them change.

How do I make my array now show only the first 18 of it?

I tried this but no success.

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arrayNeuheiten.count;

    if (arrayNeuheiten <= 17) {
        return self.arrayNeuheiten.count;
    } else if (arrayNeuheiten > 17 )
        return nil;
}

Would be great if anyone could help me with that!


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return (self.arrayNeuheiten.count<17)?self.arrayNeuheiten.count :17;

}