标签: gmgridview

GMGridView选择是最重要的

在此输入图像描述在此输入图像描述我使用GMGridView时遇到了奇怪的问题.其实我用GMGridview来展示餐厅餐桌.如果我选择Table1(这意味着第一个单元格),它应该更改为redColor(这意味着它是被占用的表).我做了这个,但我的问题是当我选择一个单元格1(红色)时,所有类别中都会显示红色,而不管我使用GMGridview.这是完全错误的,没有在另一个类中进行任何选择,它显示为选定的一个.

在下面的图像中,如果我选择了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, 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 …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios gmgridview

6
推荐指数
1
解决办法
746
查看次数

如何设置捏缩放的定位点(GMGridView)

我正在研究"太阳能"应用程序用于学习目的.我注意到可以使用捏合手势来缩放瓷砖.它的缩放方式清楚地表明已经设定了uiview的锚点.

你可以在这里看到它的视频 http://www.youtube.com/watch?v=FfgWkAuLvng

为了达到同样的效果,我下载了GMGridView代码.我试图设置锚点以获得与Solar应用程序相同的输出.

我面临的问题是,在第一次捏缩放我不能让它在锚点缩放,但其余的时间.我无法找到为什么它不是第一次从锚点缩​​放.请帮我.

我将以下方法修改为

- (void)pinchGestureUpdated:(UIPinchGestureRecognizer *)pinchGesture
Run Code Online (Sandbox Code Playgroud)

我将手势识别器的开始状态修改为

 case UIGestureRecognizerStateBegan:
        {
            [self transformingGestureDidBeginWithGesture:pinchGesture];
            _transformingItem.contentView.layer.anchorPoint = CGPointMake(0,0.5);
            break;
        }
Run Code Online (Sandbox Code Playgroud)

iphone uigesturerecognizer ios uipinchgesturerecognizer gmgridview

5
推荐指数
1
解决办法
2159
查看次数

如何避免gridView现在覆盖我的uilabel的情况:iphone

我现在拥有的是

View :
    1.UILabel :  show a text 
    2.A GMGridView : show a grid of views
Run Code Online (Sandbox Code Playgroud)

代码是

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        gridViewHolder.itemSpacing      =   SPACING;
        gridViewHolder.dataSource       =   self;
        gridViewHolder.actionDelegate   =   self;
    }
#pragma mark - GMGridViewDataSource
- (CGSize)GMGridView:(GMGridView *)gridView sizeForItemsInInterfaceOrientation:(UIInterfaceOrientation)orientation {
    return CGSizeMake(WIDTH, HEIGT);     
}
- (NSInteger)numberOfItemsInGMGridView:(GMGridView *)gridView {
    return [needs count];
}
- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index {
    cell                =   [gridView dequeueReusableCell];
    CGSize size         =   [self GMGridView:gridViewHolder sizeForItemsInInterfaceOrientation:UIInterfaceOrientationPortrait];

    if (!cell)
        cell            =   [[GMGridViewCell alloc] init];  

    UIView      *innerView                  =   [[UIView …
Run Code Online (Sandbox Code Playgroud)

iphone gmgridview

3
推荐指数
1
解决办法
574
查看次数