
在下面的图像中,如果我选择了1,它显示7也被选中…..
我的代码是
- (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,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];} 那我要在vIEwWillAppear和vIEwDIDLoad中重新加载grIDvIEw.我没有找到任何有用的东西.请帮帮我们.
解决方法- (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,size.height)]; cell.contentVIEw = vIEw; } //TRY TO RELOAD THE MG_GRIDVIEW HERE} 总结 以上是内存溢出为你收集整理的iphone – GMGridView的选择是最重要的全部内容,希望文章能够帮你解决iphone – GMGridView的选择是最重要的所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)