Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:39:13+00:00 2026-06-13T15:39:13+00:00

I got weird problem, while using GMGridView. Actually i’m using GMGridview to show the

  • 0

enter image description hereenter image description hereI got weird problem, while using GMGridView. Actually i’m using GMGridview to show the restaurant tables. If i selected Table1(that means first cell), It should change to redColor(that means it is occupied table). I did this, But my problem is when i select a cell 1(redcolor), that redcolor is showing in all classes whereever i used GMGridview. Thats is completely wrong, without any selection in the another class, it is showing as selected one.

In the images below, if i selected 1, it is showing 7 also selected…..

And my code is

- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index{



    CGSize size = [self GMGridView:gridView sizeForItemsInInterfaceOrientation:[[UIApplication 
sharedApplication] statusBarOrientation]];


    GMGridViewCell *cell = [gridView dequeueReusableCell];


    int isOccupied = [[[self.arrayOfoccupiedTables objectAtIndex:index] objectForKey:@"TStatus"] intValue];


    if (!cell)

    {

        cell = [[[GMGridViewCell alloc] init] autorelease];


        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];

        cell.contentView = view;

    }


    [[cell.contentView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];


    UILabel *label = [[UILabel alloc] initWithFrame:cell.contentView.bounds];

    label.autoresizingMask = UIViewAutoresizingFlexibleWidth | 

UIViewAutoresizingFlexibleHeight;

    label.textAlignment = UITextAlignmentCenter;

    label.backgroundColor = [UIColor clearColor];

    label.font = [UIFont fontWithName:APPFONTLI size:22.0f];

    label.adjustsFontSizeToFitWidth = YES;



    if (isOccupied == 100001) {


        label.textColor = [UIColor whiteColor];

        label.highlightedTextColor = [UIColor blackColor];

        label.backgroundColor = [UIColor redColor];//redColor];

        //colorWithRed:43.0f/255.0f green:150.0f/255.0f blue:0.0f/255.0f alpha:1.0f];//GreenColor

        label.text  = [[self.filtredArray objectAtIndex:index] objectForKey:@"TableName"];


    }else if(isOccupied == 100002) {



        label.textColor = [UIColor whiteColor];

        label.highlightedTextColor = [UIColor blackColor];

        label.backgroundColor = [UIColor colorWithRed:43.0f/255.0f green:150.0f/255.0f 
blue:0.0f/255.0f alpha:1.0f];

        //colorWithRed:215.0f/255.0f green:215.0f/255.0f blue:0.0f/255.0f alpha:1.0f];//GreenColor

        label.text  = [[self.filtredArray objectAtIndex:index] objectForKey:@"TableName"];

    }

    else if(isOccupied == 100003) {

        label.textColor = [UIColor blackColor];

        label.highlightedTextColor = [UIColor whiteColor];

        label.backgroundColor = [UIColor colorWithRed:215.0f/255.0f green:215.0f/255.0f blue:0.0f/255.0f alpha:1.0f];// Yellow Color


        //colorWithRed:229.0f/255.0f green:229.0f/255.0f blue:229.0f/255.0f alpha:1.0f];//GrayColor

        label.text  = [[self.filtredArray objectAtIndex:index] objectForKey:@"TableName"];

    }
    [cell.contentView addSubview:label];
    return cell;
}

- (void)GMGridView:(GMGridView *)gridView didTapOnItemAtIndex:(NSInteger)position
{

  NSLog(@"Did tap at index %d", position);

    [[SoundManager sharedSoundManager] playSound:SELECTED];

    //[self performSelector:@selector(registerTableToTheServer:) withObject:nil afterDelay:0.2];

    [self registerTableToTheServer:[[self filtredArray] objectAtIndex:position]];

    NSInteger tableId   =  [[[[self filtredArray] objectAtIndex:position] objectForKey:@"Table_id"] intValue];

    [self createPlistWithTableId:tableId];

    [_gmGridView reloadData];
}

And that to i’m reloading the gridview in viewWillAppear and viewDidLoad also. I didnt find anything useful. Please help me out guys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:39:15+00:00Added an answer on June 13, 2026 at 3:39 pm
    - (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index{
        
        CGSize size = [self GMGridView:gridView sizeForItemsInInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
        
        GMGridViewCell *cell = [gridView dequeueReusableCell];
        int isOccupied = [[[self.arrayOfoccupiedTables objectAtIndex:index] objectForKey:@"TStatus"] intValue];
    
        if (!cell)  {
            cell = [[[GMGridViewCell alloc] init] autorelease];
                 
            UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            cell.contentView = view;
        }
    
       //TRY TO RELOAD THE MG_GRIDVIEW HERE
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a weird problem that i don't understand why it happened. I made
We've got a weird problem while migrating our app from 1.3.7 to 2.0.0. Our
Weird problem this. I've got a web page that fades images in and out
I've got a weird problem while testing some code in Groovy Console. The following
I got a weird problem. I create an object(inside that object i call readline..)
i got a weird problem regarding egrep and pipe I tried to filter a
I've got a weird problem: both my if and else statements are executing. Here's
I've got a weird problem and it's most obviously due to my new status
I've got a weird problem where if i do something like this in a
I've got a weird problem with udp sockets. First of all, let me provide

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.