title: How can I remove or hide a sublayer?
body: <pre><code>-(IBAction)displayinfo:(id)sender
  {
      sublayer = [CALayer layer];
  
      if (appear == NO)
      {
          appear = YES;
          sublayer.contents=(id)[UIImage imageNamed:@"infoPalette.png"].CGImage;
          sublayer.frame= CGRectMake(300,200,350,250);
          [self.view.layer addSublayer:sublayer];
      }
      else
      {
          [sublayer removeFromSuperlayer];
      }
  }
  </code></pre>
  
  <p>This allows the layer to appear but I can't remove it or hide it upon clicking the same button.</p>