views:

50

answers:

1

hi all

in my application two view is there its name is Loginview and sampleview

this Loginview i added to [self.view addsubview:Loginview];

after login action. i changed self.view as [self.view addsubview:sampleview];

but that time also loginview is showing..

to avoid this. how to remove sub view in self.view

pls help me ...

A: 

This will remove all the subviews:

for (UIView *view in self.view.subviews)
{
    [view removeFromSuperView];
}
Dan Lorenc
To remove all self.view.subviews = [NSArray array]; is better. removeFromSuperView is good for removing single specific view.
porneL