I’m trying to do a program that everytime my touches end, another UIView will appear using a loop for as many as UIView I want. How can I set a loop of UIView in my touches end? or should I create it in viewDidLoad and call it in touches end?
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event//upon leaving
{
UITouch *touch = [touches anyObject];
for (int i=0; i < 100; i++) {
UIImageView *layerView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
[layerView setAlpha:.05];
[self.view addSubview:layerView];
}
}
Hope you can help me guys..
If you want to add a single view after each tap, you don’t need a for loop. Just do
Of course, you can also subclass a UIView and draw whatever you want in