right proceed exercise touchesmoved?
i have tradition uiview generates set subviews arrangement rows columns tiles. i am perplexing grasp grant user reason shade finger move, tiles underneath disappears.
the formula next tradition uiview contains tiles:
- (id)initwithframe:(cgrect)frame {
(self = [super initwithframe:frame]) {
int i, j;
int maxcol = floor(self.frame.size.width/tile_spacing);
int maxrow = floor(self.frame.size.height/tile_spacing);
cgrect support = cgrectmake(0, 0, tile_width, tile_height);
uiview *tile;
(i = 0; i<maxcol; i++) {
(j = 0; j < maxrow; j++) {
frame.origin.x = i * (tile_spacing) + tile_padding;
frame.origin.y = j * (tile_spacing) + tile_padding;
tile = [[uiview alloc] initwithframe:frame];
[self addsubview:tile];
[tile release];
}
}
}
relapse self;
}
- (void)touchesbegan: (nsset *)touches withevent:(uievent *)event {
uiview *tile = [self hittest:[[touches anyobject] locationinview:self] withevent:nil];
(tile != self)
[tile sethidden:yes];
}
- (void)touchesmoved: (nsset *)touches withevent:(uievent *)event {
uiview *tile = [self hittest:[[touches anyobject] locationinview:self] withevent:nil];
(tile != self)
[tile sethidden:yes];
}
this proceed works nonetheless however tiles denser (i.e. little tiles some-more tiles screen). iphone reduction manageable finger move. competence hittest holding cost processor struggles keep adult nonetheless opinions.
my questions are:
is an fit proceed / right proceed exercise touchesmoved?
if isn't, permitted approach?
i attempted relocating functionality tradition tile category (a servant uiview) category above emanate supplement subview. subview tile hoop touchesbegan nonetheless finger move, tiles does accept touchesbegan even given touches still biased initial reason sequence. there proceed exercise by subview tile class, tiles accept touchesbegan/touchesmoved eventuality finger move?
Comments
Post a Comment