was0107 / MDetailFramework

淘宝商品详情页面控件

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reload 之后delegate问题

OYcedar opened this issue · comments

当页面reload之后,不会再次响应didChangeToSection和willChangeToSection

以下是配置代码:

  • (UIView *) viewAtTop {
    return self.tableView;
    }

  • (NSUInteger ) numberOfSections {
    return 1;
    }

  • (NSString *) titleOfSectionAt:(NSUInteger )index {
    return @"";
    }

  • (UIView *) viewOfSectionAt:(NSUInteger ) index {
    UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectZero];
    webview.delegate = self;
    return webview;
    }

  • (void) didChangeToSection:(NSUInteger) index view:(UIView *) view {
    if (index == 0) {
    NSString *urlString = [NSString stringWithFormat:@"%@%@?goodsId=%@", HOME_URL, GOODS_DETAIL_INFO_URL, self.goodsId];
    [(UIWebView *)view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
    [(UIWebView *)view reload];
    }
    NSLog(@"did= %ld %@", index, view);
    }

  • (void) willChangeToSection:(NSUInteger) index view:(UIView *) view {
    NSLog(@"will=%ld %@", index, view);
    }