Continuing with the axiixc comment, here is some code that you can use to place the button at the bottom of the web view. By placing a positioning code in a layout subsample, you can handle the rotation correctly.
- (void)webViewDidFinishLoad:(UIWebView *)webview{
if (!_button){
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:@"Move All Blue Cards to Known" forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"signin-button-blue-color"] forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
button.titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
[_webview.scrollView addSubview:button];
_button = button;
}
[self setNeedsLayout];
[self layoutIfNeeded];
}
- (void)layoutSubviews{
[super layoutSubviews];
float y = 0;
CGRect originalRect = _webview.frame;
_webview.frame = CGRectMake(0, 0, originalRect.size.width, 1);
CGSize contentSize = _webview.scrollView.contentSize;
_webview.frame = originalRect;
if (contentSize.height < _webview.frame.size.height){
y = _webview.frame.size.height - 64;
} else {
y = contentSize.height + 20;
}
_button.frame = CGRectMake(20, y, self.frame.size.width-40, 44);
contentSize.height = CGRectGetMaxY(_button.frame)+20;
_webview.scrollView.contentSize = contentSize;
}
source
share