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
Post a Comment