Hi,
So I have a button action that instantiate a new view when pressed.
But the problem is if the user press the button multiple times, duplicate views would pop up.
How do I detect if the object view already exists?
I was thinking below but obviously it won't work.
So I have a button action that instantiate a new view when pressed.
Code:
- (void)slideButton:(id)sender {
CGRect sliderFrame = CGRectMake(0.0f, 0.0f, 320.0f, 416.0f);
AnimationView *pickerview = [[[AnimationView alloc] initWithFrame:sliderFrame] autorelease];
[self.view addSubview:pickerview];
[pickerview hideSlide];
[pickerview slideUp];
}
But the problem is if the user press the button multiple times, duplicate views would pop up.
How do I detect if the object view already exists?
I was thinking below but obviously it won't work.
Code:
- (void)slideButton:(id)sender {
[B]if(!pickerview) {[/B]
CGRect sliderFrame = CGRectMake(0.0f, 0.0f, 320.0f, 416.0f);
AnimationView *pickerview = [[[AnimationView alloc] initWithFrame:sliderFrame] autorelease];
[self.view addSubview:pickerview];
[pickerview hideSlide];
[pickerview slideUp];
[B]}[/B]
}