Adding a header view to a UIWebView similar to Safari and Articles

前端 未结 7 1883
耶瑟儿~
耶瑟儿~ 2020-12-07 19:17

I\'d like to add a header view to an UIWebView similar to the address/search bar in MobileSafari and the excellent Articles.app by Sophia Teutschler. More preci

7条回答
  •  萌比男神i
    2020-12-07 19:44

    Try this:

        UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, -100, WIN_WIDTH, 100)];
        redView.backgroundColor = [UIColor redColor];
        self.view.scrollView.contentInset = UIEdgeInsetsMake(100, 0, 0, 0);
        [self.view.scrollView addSubview:redView];
        NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.baidu.com"]];
        [self.view loadRequest:request];
    

提交回复
热议问题