Programaticly adding items and alter later

Discussion in 'iOS Programming' started by DennisBlah, Nov 14, 2014.

  1. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #1
    Hi all,

    I doubt this is possible, but its quite needed for an project of mine.
    I have a dynamic list in a plist, which I'm printing on the screen.

    Now, I want to fire an timer, that will loop through the same list, but checking some statements, and it should be changing an image infront of the printed value.

    Can I do this programaticly, or should I be redrawing the image, and somehow remove the old one ?

    Thanks!
     
  2. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Apple has a sample code project that displays time zones in a tableview. The app shows an image of a moon or sun to indicate if the time zone is currently in sunlight or darkness and it updates the rows dynamically as time passes to change the moon/sun image based on the time.

    I think this sample is called TableView Fundamentals for iOS.
     
  3. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #3
    Code:
        NSArray *visibleCells = self.tableView.visibleCells;
        for (APLTimeZoneCell *cell in visibleCells) {
            NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
            [self configureCell:cell forIndexPath:indexPath];
            [cell setNeedsDisplay];
        }
    
    That might be helpfull! however I'm not working with a for loop but with a timer, and waiting for an reply of another class. After this reply I go to the next cell :)

    Thanks for the tip!
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    To me, it's not that this is a for loop vs. a timer action but what happens in that for-block that is the key to solving your issue.
     
  5. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #5
    Look up iOS game animation loops and the use of CALayers or spritekit.
     
  6. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #6
    Actually it is working like i want it to :)

    Thanks all!
     

Share This Page