how to make an editable grid?

Discussion in 'iOS Programming' started by newConvert, Apr 2, 2009.

  1. newConvert macrumors regular

    Aug 25, 2006
    Hello Everyone,

    Fairly new to the iphone dev, so I was hoping someone could help me out... couldn't find anything through a search.

    I am making a free app for my friends and I that will keep track of a bunch of scores for various teams/sports that we are interested in... I am trying to make a large grid, for arguments sake 8x8 (64squares) and be able to edit/change the values in each one. IE click in a square and the numberpad pops up.

    Any advice? I really can't think of a way to draw the grid. Thanks so much.
  2. iphonedevelop18 macrumors member

    Feb 26, 2009
    just make an image of the grid on photo shop or something
  3. admanimal macrumors 68040

    Apr 22, 2005
  4. bboyjayz macrumors member

    Mar 20, 2009
    Maybe you can do i thing like that:
    this pice of code take an array of ImageView, and add the imageView on the mainView (here, i build a 5/5 grid). After what, if you want to check if the user push one of the images, you just have to write a touchesBegan method;.
    Actually I don't if it's the best way to do this, but i know it works (i'm using it)

    CGPoint position;
    position.x = 100;
    position.y = 200;
    for(int i = 0; i<ROW; i++){
    for(int j=0; j<COL; j++){
    plateau[j] = [self newPieceViewWithImageNamed:mad:"blueSquare.png" atPostion:position];
    [plateau[j] setEtat:0];
    [self addSubview:plateau[j]];
    position.x += 30;
    dejaPasser[j] = NO;
    position.y += 30;
    position.x = 100;

    PS: i've forogot to say that newPieceViewWithImageNamed:mad:"blueSquare.png" atPostion:position] just put the imageView at the position "position" with image named "blueSquare.png"...
  5. newConvert thread starter macrumors regular

    Aug 25, 2006

    Thanks so much! Going to take a look at that and make sure I know whats going!

Share This Page