Nachladen Sammlung anzeigen

Ich Schreibe eine app in Objective C. ich habe benutzerdefinierte Zelle in Sammlungen-Ansicht. Zunächst lädt er die Daten aus der SQLite-Db und zeigt Sie in der Ansicht Sammlung innerhalb jedes benutzerdefinierte Zelle. Und es zeigt Zellen, die auf Auflistung anzeigen.

Sobald ich neu laden Ansicht Sammlung der Ansicht Sammlung bleibt in der Farbe schwarz.

Code:

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 3;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [self readRowCount:@"SELECT COUNT(label) FROM colour;"];
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%d", [arrColour count]);
    CustomViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ItemCell" forIndexPath:indexPath];

  // if (cell == nil) {
    //   cell = [[CustomViewCell alloc]init];
    //}

    cell.label.text = [NSString stringWithFormat:@"%@",[ [arrColour objectAtIndex:indexPath.item ]label] ];

    CellData *redObj = [arrColour objectAtIndex:indexPath.row];
    CellData *greenObj = [arrColour objectAtIndex:indexPath.row];
    CellData *blueObj = [arrColour objectAtIndex:indexPath.row];

    float redF = [[redObj red] floatValue];
    float greenF = [[greenObj green] floatValue];
    float blueF = [[blueObj blue] floatValue];
    //NSLog(@"Colours: %f-%f-%f", redF, greenF, blueF);
    cell.backgroundColor = [UIColor colorWithRed:redF/255.0f green:greenF/255.0f blue:blueF/255.0f alpha:1];

    return cell;
}

Den Ort, den ich neu laden von Daten - die Taste:

- (IBAction)btnAdd:(id)sender {
   NSString *myRed = [NSString stringWithFormat: @"%1.4f", slideR.value];
   NSString *myGreen = [NSString stringWithFormat: @"%1.4f", slideG.value];
   NSString *myBlue = [NSString stringWithFormat: @"%1.4f", slideB.value];
    if(txtField != nil){


        [colMain reloadData];
    }

Den arrColour (Mutable-Array) in dieser situation enthält die gleiche Menge von Elementen. Was bedeutet der collection view wurde nicht neu geladen?

InformationsquelleAutor uml | 2013-02-03

Schreibe einen Kommentar