大佬教程收集整理的这篇文章主要介绍了iphone – GMGridView的选择是最重要的,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在下面的图像中,如果我选择了1,它显示7也被选中…..@H_944_21@
- (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.我没有找到任何有用的东西.请帮帮我们.@H_944_21@
- (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的选择是最重要的所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。