davie davie - 1 year ago 49
iOS Question

iOS Webview with native buttons

got a quick question I have a Webview in my app witch is a full screen now I want to know is it possible to create a uibutton that lays on top of the Webview for example if you set a button over a image but to do it in objective c programmatically?

Answer Source

yes you can.

Then add the following in one of your methods (for example, viewDidLoad)

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); //position
[buttonName setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // set text color

[webview addSubview:button]; // add it on top
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download