tags:

views:

93

answers:

0

Hello,

How can i disable touch of CALayer (UIView Layer). i have create springbord screen display icon. and i have display 27 icon on screen and i want to disable touch any five icon (i.e. 2 and 3 index icon). gridView = [[UIView alloc]init]; //[gridView setUserInteractionEnabled:NO];

int gridH,gridW;
for (int row = 0; row <Row; ++row) 
{
 for (int col = 0; col < TILE_COLUMNS ; ++col) 
    {

    CGRect frame = CGRectMake(TILE_MARGIN + col * (TILE_MARGIN + TILE_WIDTH),TILE_MARGIN + row * (TILE_MARGIN + TILE_HEIGHT),TILE_WIDTH, TILE_HEIGHT);

        NSString *APPICON = [arrayIcon objectAtIndex:index];
        UIImage *aImage = [UIImage imageNamed:APPICON];  //objSlideData.imgCaptured;

        // CALayer class
        WiggleEffect *objWiggle;
        tileFrame[index] = frame;
        objWiggle = [[WiggleEffect alloc]init];
        objWiggle.tileIndex = index;
        tileForFrame[index] = objWiggle;
        objWiggle.frame = frame;

        objWiggle.backgroundColor = [UIColor colorWithPatternImage:aImage].CGColor;
        objWiggle.delegate = self;

         UIGestureRecognizer *TapPressRecognizer;   //Long Press 
         TapPressRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LongClick:)];
         UITapGestureRecognizer *pgr = (UITapGestureRecognizer *)TapPressRecognizer;

         UIGestureRecognizer *LongRecognizer;
         LongRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(LongClick:)];
         UILongPressGestureRecognizer *lp = (UILongPressGestureRecognizer *)LongRecognizer;

         [gridView addGestureRecognizer:pgr];
         [gridView addGestureRecognizer:lp];


        if (index == 2)
        {
            //objWiggle.hidden = TRUE;
            [CATransaction begin];
            [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
            // change property here, e.g.:
            //objWiggle.position = CGPointMake(0, 0);
            [CATransaction commit];   

        }

        [gridView.layer addSublayer:objWiggle];

        [objWiggle setNeedsDisplay];
        [objWiggle release];

        gridW = col * (TILE_MARGIN + 90) + 90;
        gridH = (row + 1)*(TILE_MARGIN + 90 ) + 90;

    }

    gridView.frame= CGRectMake(0, 0, gridW, gridH);
    gridView.center=self.view.center;
    [self.view addSubview:gridView];

}

So how can disable touch for particular index icon.

Thanks you