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 -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -