transitapp / svwebviewcontroller Goto Github PK
View Code? Open in Web Editor NEWA drop-in inline browser for your iOS app.
License: MIT License
A drop-in inline browser for your iOS app.
License: MIT License
Hi there,
My app doesn't support landscape but my users have asked if your browser control could flip for them. How can I enable landscape orientation support for just your view controller?
self.navigationController.toolbar.barTintColor = self.navigationController.navigationBar.barTintColor;
needs to be added
The dealloc method of the SVWebViewController class doesn't call [super dealloc];
I'd like to explicitly stop loading on the webview when popping the view controller but the webview is an internal property so I can't do this without modifying your class.
i'm looking to do this because i'm getting crashes when a user hits back and pops the SVWebViewController off the stack while it's still loading.
is there an ideal way to go about this, short of making the webview public?
Hi, nice library... Thanks for this wonderful plugin.
It is possible to use it with storyboard? I have a nice storyboard with segue, but the perfectly integration isn't actually possible. Have there anybody any idea?
I'm trying to use barsTintColor
to change an SVModalWebViewController's toolbar color to black. Code:
SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithAddress:@"http://google.com"];
webViewController.barsTintColor = [UIColor blackColor];
[self presentModalViewController:webViewController animated:YES];
The color is applied to the left button item and most of the toolbar as expected, but the buttons on the right side of the toolbar (reload, back, forward, action) and the area behind them aren't affected.
iOS 5.1, iPad, Xcode 4.4.1
Not a bug, more a feature request. It would be really nice if the modal view controller would have a option to hide all bars on scrolling down. If you scroll up, they appear again. Saw that feature in a lot of apps.
I hit a use-case where I had to open POST requests in SVWebViewController.
Therefore it would be nice to be able to init a controller with an NSURLRequest.
The change was straightforward, changing the URL property to URLRequest.
I can submit a PR with my monkey-patched version, if you're interested in this.
If you present the non-modal (didn't try the modal) VC like so:
SVWebViewController *vc = [[[SVWebViewController alloc] initWithAddress:@"http://www.someslowsite.com"] autorelease];
[self.navigationController pushViewController:vc animated:YES];
Then quickly hit the Back button while the site is loading, you can often get a bad access fault thrown. This was tracked down to not clearing the delegate (mainWebView.delegate = nil;) before the VC gets autoreleased.
Not sure where the best place to implement this fix would be but I put it in viewWillDisappear: and re-registered the delegate in viewWillAppear: because there's no existing dealloc method.
I’ve recently added SVWebViewController to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, SVWebViewController doesn't have version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
It doesn't seem as though the latest version of the repo is being pulled from Cocopods. Might want to check into it.
Looking at the recent patches a new release tag with updated PodFile would be great.
I think it'd be pretty neat if your history was stored in a singleton, and you could add a swipe UIGesture to load the previous page, or if you loaded the previous page, to go back to the page you were on.
If there's interest, I could add this...
Currently there are no @2x versions for ipad.
this will probably result in a rejection from Apple under 'user confusion'
action button needs to dismiss a popover if one is already showing rather than adding more
This property does nothing at all. What is the point of it? Where is the right place to change the tint color of the bottom toolbar?
When presenting SVWebViewController via the SVModalViewController, the bottom toolbar will slide in from the right as if the view is being pushed. I feel like there is a simple reason for this but I can't figure it out, I'm still quite inexperienced.
Also in SCWebViewController.m when calling self.navigationController setToolbarHidden:YES animated:NO;
the toolbar still animates (and from the right). If I call [self.webViewController.navigationController setToolbarHidden:NO animated:animated];
in SVModalWebViewController.m then the toolbar doesn't rush in from the right.
I'm still unsure how to do a pull request (or if that's the right thing to do in this situation). Let me know what I should do.
Localization files is not included in the Pod for SVWebViewController
Using the modal web view controller in an iPad page sheet, clicking the share button gives:
Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7fb38c8e7fe0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
Might be related to JASidePanel. I'm presenting the SVModalWebViewController on the right panel and when dismissing, the right panel has disappeared. Doesn't happen with the left panel though. Any idea?
I have following code to display the model view of SVWevViewController but I cant see the change on SVView DONE button ? why ?
NSString *linkURL = [[[self allItems] objectAtIndex:[self itemNo]] valueForKey:@"link"];
UIImage *buttonImage = [UIImage imageNamed:@"btn_left"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);
[button addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithAddress:linkURL];
webViewController.navigationItem.leftBarButtonItem = customBarItem;
[self presentModalViewController:webViewController animated:YES];
I've tried different things. Sometimes I don't want a toolbar at all.
Thanks a lot for great library. I'm trying to use it with a web site link, but when click some links I don't get any action. Then an action sheet is displayed with title "JavaScript" and two buttons "Open" and "Cancel". I have used "Open" button, but nothing happened. I would appreciate your help.
I have found out that web view delegates are not firing in this case.
Hi Sam
Beautiful library! I am hoping to use it in my app Tunepal. A question for you...
Whats the best way to use this in a tab (in a tab bar) in interface builder? What I have done is:
Created subclasses of SVWebViewController
Overiden the - (id)initWithCoder:(NSCoder *)inCoder method and called:
return [[super initWithCoder:inCoder]initWithURL:url];
Set the tab to be a subclass of SVWebViewController
Somehow I dont think this is right :-)
What is happening is:
The tabs are displaying ok with the appropriate url, but not handling rotations correctly. Portrait is ok, but when I rotate to landscape, the width stays the same.. It could be because my MainWindow.mm which contains the tab controller implements autolayout and perhaps this "property" is getting passed into the SVWebViewConroller, however my map tab displays and rotates ok...
Any ideas?
Bryan
I push the SVWebViewController, web page loads, everything is fine. If I remain in portrait mode then pushing back button works fine. However, if I rotate the device to landscape mode while looking at the SVWebViewController and then push the back button the app crashes. The view that it's trying to go back to only supports portrait mode. I have two other views that allow rotation that work fine when going back. Not really sure what's going on as I've tried a lot of things and nothing has an effect. Also, when it crashes it's just breaking in Main and not anywhere useful.
So at least on an iphone, when the web view controller is introduced without a navigation controller (for instance, if it's presented modally) you create a new nav bar and nav item, and then release the nav item ... but then in setupToolbar, you access navItem again, after it's been released.
When you load a page that has many iframe UIwebView send many load requests and isLoading is always true. In this situation action button is not available and reload control as well
If there is, how can I do it?
I get the following error when running the stock SVWebViewController
from master on an iPad with iOS7 (or the simulator).
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UIToolbarButton imageForState:]: unrecognized selector sent to
instance 0x8ab3260'
While Xcode breaks for the exception in viewWillDisappear
on the previous controller, I found out that the following changes make the crash disappear:
In updateToolbarItems
comment out these lines (in the iPad branch):
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, toolbarWidth, 44.0f)];
toolbar.items = items;
toolbar.barStyle = self.navigationController.navigationBar.barStyle;
toolbar.tintColor = self.navigationController.navigationBar.tintColor;
Since the UIToolbar is not used on the iPad I don't see any reason to have the code in there.
Sadly I am not proficient enough in iOS development to explain how this code could cause the previous crash.
Hi I am using your "SVModalWebViewController.h","SVWebViewController.h" , to play youtube video , which is posting by our customer. I need to track touch events in SVWebViewController web view. This will load you tube player in your web view , with URL what we are sending. But , If others trying to search , or play other video it allows. We need to have control on this. Other than supplied URL , other actions except play should be disabled. Hope you get my point. How to do this? Kindly help me out.
Thanks,
Femina
I think it will be cool and great if your library support those features. Developer love to embed entire browser in a single line of code
Thank
Is there any reason why the Podspec iOS 7 only ?
I tested the latest 1.0 release and it works fine on iOS 6 also. Only difference i see is the safari and chrome images which should be different for iOS 6.
please check the below link: https://store2960330.ecwid.com/
after click on the every product the toolbar buttons is not working well.please guide me with this point.
Right now:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(deviceIsTablet)
return YES;
}
Leads to a warning on the iphone console saying that this method should say YES to something.
I think it should be:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(deviceIsTablet)
return YES;
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
I've recently updated to the latest version of SVwebviewcontroller, since then whenever I visit a page which contains a 'HTML select dropdown' and tap on it the webview does not present a UIPicker as it used to.
Not sure where to start, anyone else had this?
Thanks
it would be nice if the toolbar would be a accessible property to change the tintColor
I have leaks in sample app when controller appear/disappear many times.
GeneralBlock-...
http://www.flickr.com/photos/62807440@N04/5760975321/in/photostream
To support custom implementations in the action sheet and to provide a kind-of-future-proof implementation I am suggesting and going to implement a property excludedActivityTypes
(NSArray of NSStrings) plus a set of string constants SVActivityTypeSafari
, SVActivityTypeMail
and SVActivityTypeCopyToPasteboard
that replace the current bit set availableActions
.
Custom activities derive from SVActivity
and can be provided via the property applicationActivities
(NSArray of SVActivity). Each activity implements the methods
- (NSString *)activityTitle
- (void)performActivity
and can use the derived property webView
inside performActivity
to complete its work.
SVActivity
as well as the standard activities are implemented in SVWebViewController.h/.m
. The current implementation of actionSheet:clickedButtonAtIndex:
and pageActionSheet
will be refactored to take advantage of this design.
Highly appreciating any comments as I will post my progress here, too.
When presenting as a full-screen modal, to, say, google.com, clicking in the text field will cause the modal to shrink at the top for some reason. It may be due to auto layout, I don't know.
I fixed it by adding:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
Then setting the frame to 1024x768 again in those methods.
Hi Sam,
Great library, very useful for my project.
I ran into one issue trying to use
It appears that in loadView, the loadHTMLString command is getting immediately overwritten by the loadURL command, resulting in a blank screen when offline, even when the cached web page is present. I fixed it by putting the following two lines in viewDidAppear.
[self loadURL:self.URL];
self.view = mainWebView;
I'm new to GitHub, should I make this into a pull request or is it fine as an issue?
Greg
I use this library to open payment menthod page, i have an issue when the page have js pop up or open new window, this webview can load the page :(
Maybe iOS8 quickly show web view controller before call viewWillAppear,
cause of can not set property.
When I am using SVModalWebViewController in my app, I am often providing a link to the user which will redirect to the final page. But while redirecting, the title of the page gets stuck at 'Redirecting to request website'
I want to remove/hide the title of the page or have the ability to update it.
Is this possible?
I am trying to use an alternate to UIWebView as my detail view. Is SVWebViewController an option for me ? I tried using it but looks like it has to be contained in a Navigation controller.
what would be great is if we could edit the actions.
f.e.
webViewController.actionEmailEnabled = NO;
webViewController.actionSafariEnabled = YES;
webViewController.actionCopyEnabled = YES;
something like this, or as an array.
(as you can see, a 'copy link' action would be cool)
While I guess there are better ways to observe a changing title (KVO on the UIWebView), I was wondering why you explicitly disregard title changes after the initial load?
See:
Would you be interested in a PR which removes that above line and uses KVO to get all title updates (for example from JS) (untested, but I think this should work).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.