iphone - How can i clear web view on switching from one class to another? -
i have webview in detailviewcontroller load html formatted local text show details, detailviewcontroller has button, when pressed want clear web view other detail show clear avoid flick of reloading.
in detailviewcontroller have-
- (ibaction)backbuttonclicked:(id)sender { [_delegate backfromdetailview]; } -(void)clearwebview{ [[nsurlcache sharedurlcache] removeallcachedresponses]; [self.detailwebview loadhtmlstring:@"<html><head></head><body></body></html>" baseurl:nil]; [self.detailwebview reload]; } -(void)changedetailviewtextto:(nsstring *)text{ nsstring *htmlstring=[htmlstring gethtmlstringforstring:text]; [self.detailwebview loadhtmlstring:htmlstring baseurl:nil]; }
and in mainviewcontroller have
-(void)backfromdetailview{ ((detailviewcontroller*)_detailsviewcontroller).delegate=nil; [((detailviewcontroller*)_detailsviewcontroller) clearwebview]; }
still flicking text, please help.
you can load webview default blank page.
[self.detailwebview loadrequest: [nsurlrequest requestwithurl:[nsurl urlwithstring:@"about:blank"]]];
Comments
Post a Comment