subview removeFromSuperview is not removing view in my function
<p>i am developing a simple application.</p>

<p>in my application i have 2 views.</p>

<p>in one button click even i add one view as subview to the self.view.</p>

<p>TO remove from it i crate a method like this.</p>

<pre><code> - (void)validateview {
    NSLog(@"removing view");
    [seconview removeFromSuperview];

    }
</code></pre>

<p>in the another button click event i write the fallowing code.</p>

<pre><code>[self validateview];
</code></pre>

<p>but i does n't remove view,but it prints removing view in console.</p>

<p>But i am trying in another button click <code>[seconview removeFromSuperview];</code>
then it works fine,it removes subview.</p>

<p>But i need to remove by calling </p>

<p>but it is not remove view validateview,because i need to validate ilike this.</p>

<p>i am saving a value in nsuserdefaults,</p>

<p>if that value is > 0 then i need to remove view else no need of removing.</p>

<p>how can i done can any one please help me.   </p>
