IMPORTANT: on Oct 26th 2011, SVWebViewController received a major overhaul of its inner working. Upgrading from an earlier version of a SVWebViewController will crash your app if you’re presenting SVWebViewController modally (using presentModalViewController:
). Please update your code and use SVModalWebViewController
in replacement of SVWebViewController
when it’s presented modally.
is a simple inline browser for iOS. The iPhone UI is highly based on Tweetie’s inline browser, and the iPad version on Reeder.
SVWebViewController features:
- iPhone and iPad distinct UIs
- full landscape orientation support
- back, forward, stop/refresh and action buttons (with actions “Open in Safari” and “Mail Link”)
- navbar title set to the currently visible web page
- talks with
setNetworkActivityIndicatorVisible
- Drag the
SVWebViewController/SVWebViewController
folder into your project. - Add the MessageUI framework to your project
(see sample Xcode project in /Demo
)
Just like any UIViewController, SVWebViewController can be pushed into a UINavigationController stack:
SVWebViewController *webViewController = [[SVWebViewController alloc] initWithAddress:@"http://google.com"]; [self.navigationController pushViewController:webViewController animated:YES]; [webViewController release];
It can also be presented modally using SVModalWebViewController
:
SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithAddress:@"http://google.com"]; [self presentModalViewController:webViewController animated:YES]; [webViewController release];
SVModalWebViewController
boasts a barsTintColor
property, if you’re into giving the navigation bar and toolbar a custom tint color.
Use the availableActions
integer bit mask property to set which actions should be available for display:
enum { SVWebViewControllerAvailableActionsNone = 0, SVWebViewControllerAvailableActionsOpenInSafari = 1 << 0, SVWebViewControllerAvailableActionsMailLink = 1 << 1, SVWebViewControllerAvailableActionsCopyLink = 1 << 2 };
Default is SVWebViewControllerAvailableActionsOpenInSafari | SVWebViewControllerAvailableActionsMailLink
.
SVWebViewController doesn’t support ARC. You can disable ARC on a per-file basis by adding the -fno-objc-arc
compiler flag for those files (see this StackOverflow thread for reference). Anyone who loves ARC enough to add it to SVWebViewController is welcome to open a pull request and I’ll be happy to create a new ARC branch.
SVWebViewController is brought to you by Sam Vermette and contributors to the project. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by creating new issues. If you’re using SVWebViewController in your project, attribution would be nice.