Quote:
Originally Posted by bytor99999
Please post your code so we can see where you went wrong. removeFromSuperview should be the best to use. But you call it on the button you want to remove.
But we need to see code.
Remember to use the code button which is the number sign/pound sign in the toolbar above.
Mark
|
CODE:
- (IBAction)action

id)sender
{
NSLog(@"Segment %d selected", [sender selectedSegmentIndex]);
iRemoveSubview1 *subview1=[[iRemoveSubview1 alloc] initWithFrame:CGRectMake(11,100,111,222)];
iRemoveSubview2 *subview2=[[iRemoveSubview2 alloc] initWithFrame:CGRectMake(11,100,111,222)];
if ([sender selectedSegmentIndex]==0)
{
[self addSubview:subview1];
//[subview1 removeFromSuperview]; if not commented, subview will be removed
}
if ([sender selectedSegmentIndex]==1)
{
NSLog(@"inside textfield...if");
[subview1 removeFromSuperview];// subview1 is not removed
[self addSubview:subview2]; // subview1 and subview2 both are overlapped
}
}