ios - Unable to remove view from superview -


i using banner code, show banner in below example code

   hzbanneradoptions *options = [[hzbanneradoptions alloc] init];         [hzbannerad requestbannerwithoptions:options success:^(hzbannerad *banner) {             [viewcontroller.view addsubview:banner];         } failure:^(nserror *error) {             nslog(@"error = %@",error);         }]; 

however, when want hide/remove banner, use this;

[self.currentbannerad removefromsuperview];     self.currentbannerad = nil; 

but not working, banner still there, have tried variants such

[currentbannerad sethidden:yes]; 

with no success, ideas how remove banner view?

when add banner view, have no reference it, have assign property this:

hzbanneradoptions *options = [[hzbanneradoptions alloc] init]; [hzbannerad requestbannerwithoptions:options success:^(hzbannerad *banner) {     self.currentbannerad = banner;     [viewcontroller.view addsubview:self.currentbannerad]; } failure:^(nserror *error) {     nslog(@"error = %@",error); }]; 

and remove using own code, add layoutifneeded line:

[self.currentbannerad removefromsuperview]; self.currentbannerad = nil; [viewcontroller.view layoutifneeded]; 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -