ios,objective-c,uitableview,uiwebview
I don't think this is bad practise at all. Sure there's probably going to be someone that comes up with a better way technically but this seems the way to go to ensure better user experience so that the webview isn't reloading every time the user want's to see it
objective-c,uiwebview,xcode6.1,ios8.1
Since you are using a storyboard you must use a Segue to present your ViewController. Delete your button action implementation and Control+Drag from your button onto your Help view controller. Link it to the Show segue.
Your code is calling imageClicked at the point you're trying to just set it up as a handler. It's actually easier than you think it is: var imgs = document.getElementsByTagName("img"); for (var i = 0; i < imgs.length; i++) { imgs[i].onclick = imageClicked; // <=== Not *calling*, just referring to...
javascript,ios,scroll,uiwebview
I'm surprised that the scroll event isn't firing. MDN has a list of events that can be bound to that might be of help to you. A quick thought that jumps out to me is that you could bind to the mouseup and input/change events on the select and in...
I would suggest to use request.URL.host instead of retrieving it with auxiliary function and check if request.URL.scheme isEqualToString "my link" to be sure it's not some normal request. By the way, you probably don't want any requests with your custom scheme to be really performed, so return false to avoid...
ios,objective-c,uitableview,uiwebview
Skyler's answer's heading in the right direction, but it's missing a few critical pieces... Yes, you need to pass the web url string in prepareForSegue: like he's suggesting, i.e. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"recipeDetail"]) { NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; RecipeTableViewCell *cell = (RecipeTableViewCell*)[self.tableView cellForRowAtIndexPath:indexPath]; RecipeDetailViewController *recipeDetail =...
I forgot to set the constraints for the UIWebView, which caused the content to be rendered wrongly. I don't know how that's relevant, but constraining the UIWebView seems to not only render the content correctly but also display the mobile site.
javascript,ios,objective-c,swift,uiwebview
This solve my problem, var value = IBwebView.stringByEvaluatingJavaScriptFromString("get_JSON()") var err:NSError? var obj:AnyObject? = NSJSONSerialization.JSONObjectWithData(value!.dataUsingEncoding(NSUTF8StringEncoding)!, options:nil, error:&err) if let items = obj as? NSDictionary { var data1:String = items.objectForKey("data1") as? String var data2:String = items.objectForKey("data2") as? String var data3:String = items.objectForKey("data3") as? String } ...
html,ios,uiwebview,uiscrollview
the content of the uiwebview changed and reloaded.. one of solutions that i see is to check the previous offset of the uiwebview and store it..when the new html string is loaded scroll your web view to the same offset. if you can get the difference between the two html...
ios,swift,uiwebview,uiscrollview,xcode6
Looks like it was a constraint problem, because when I add to the webViewDidFinishLoad this line: webView.addConstraint(NSLayoutConstraint(item: webView, attribute: NSLayoutAttribute(rawValue: 8)!, relatedBy: NSLayoutRelation(rawValue: 0)!, toItem: nil, attribute: NSLayoutAttribute(rawValue: 0)!, multiplier: 1.0, constant: (webView.scrollView.contentSize.height + 600.0))) It fixed the problem....
This category adds methods to the UIKit framework’s UIWebView class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling....
// show HTML content in webview there is two different types, as follow // 1. Using URL // for show web view with online url [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://jlhs.schoolloop.com/mobile/login"]]]; // 2. Using string // for show web view with help of string, local page NSString * htmlPage = @"<html><head><meta...
ios,objective-c,iphone,uitableview,uiwebview
I still don't know why this is happing but I solved it using the following approach: I moved [tableView beginUpdates] and [tableView endUpdates] instructions to webViewDidFinishLoad method. At this way, whenever webViewDidFinishLoad be executed, it will updated the cell size correctly. Although I don't think that is the best solution,...
ios,objective-c,uiwebview,orientation
Put this in your AppDelegate: - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { id presentedViewController = [window.rootViewController presentedViewController]; NSString *className = presentedViewController ? NSStringFromClass([presentedViewController class]) : nil; if (window && [className isEqualToString:@"AVFullScreenViewController"]) { return UIInterfaceOrientationMaskAll; } else { return UIInterfaceOrientationMaskPortrait; } } Note: I have not tested this with...
ios,pdf,uiwebview,qlpreviewcontroller
The short answer to your question is: yes. The longer one is, well... a bit longer :) PDF/A, or PDF for Archival is an ISO standard that is based on the ISO standard for PDF itself (ISO 32.000). As a consequence, any software that supports "PDF" must also necessarily support...
ios,xcode,uiwebview,uisplitviewcontroller
Have you tried conforming to the UIWebViewDelegate protocol? UIWebViewDelegate has these callbacks that will help you debug: webView:shouldStartLoadWithRequest:navigationType: webViewDidStartLoad: webViewDidFinishLoad: webView:didFailLoadWithError: All you need to do is find the identifier for the segue and pass the URL string to the DetailViewController when trying to segue into that controller and actually...
ios,swift,uiwebview,mpmovieplayercontroller
Here's what's going on. When user interacts with UIWebView, it becomes first responder and inputAccessoryView provided by view controller disappears (no idea why behavior in this case is different from, say, UITextField). Subclassing UIWebView and overriding inputAccessoryView property does not work (never gets called). So I block interaction with UIWebView...
Did you tried to set a delegate to the ScrollView instead of using the events? Something like this: public class ScrollViewDelegate : UIScrollViewDelegate { public override void Scrolled(UIScrollView scrollView) { Console.WriteLine("Scrolled"); } } ContractWebView.ScrollView.Delegate = new ScrollViewDelegate(); EDIT: Here is the complete code that I used for the test and...
1: When you have set the NSUserDefaults for the key "host", have you also called synchronize on NSUserDefaults? 2: Please debug the variable NSString *host, is the right string in it? 3: Instead of NSString *fullURL = [NSString stringWithFormat:@"%@ %@", host, complement]; try this host = [host stringByAppendingString:complement]; 3.1: Is...
ios,objective-c,uiwebview,ios-simulator,mainbundle
That is correct. On iOS an App's bundle is read-only. Any attempts to save changes into your bundle will fail on an iOS device. On Mac OS the bundle is not read-only, but you should still treat it as read-only. Modifying your app's bundle is a bad idea. If the...
ios,swift,uiwebview,uitextview,nsattributedstring
extension String { var html2AttStr:NSAttributedString { return NSAttributedString(data: dataUsingEncoding(NSUTF8StringEncoding)!, options:[NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: NSUTF8StringEncoding], documentAttributes: nil, error: nil)! } } let yourAttributedText = "<style type=\"text/css\">#red{color:#F00}#green{color:#0F0}#blue{color: #00F; font-weight: Bold; font-size: 32}</style><span id=\"red\" >Red,</span><span id=\"green\" > Green...
ios,objective-c,iphone,uiwebview
set your web view delegate and frame. yourwebview.frame=[[UIScreen mainScreen] bounds]; yourwebview.delegate = self; end then use this delegate method to set height. - (void)webViewDidFinishLoad:(UIWebView *)aWebView { CGSize contentSize = aWebView.scrollView.contentSize; NSLog(@"webView contentSize: %@", NSStringFromCGSize(contentSize)); yourwebview.contentsize = contentSize; } ...
ios,objective-c,iphone,twitter-bootstrap,uiwebview
To me it looks like the UIWebView is not set up correctly in the Storyboard or Interface Builder. Do you use Auto Layout? If so, are the constraints set correctly? A simple way to make sure the UIWebView is displayed full screen would be to add 4 constraints that align...
As most of the parameters reference the Request collection you could put the parameters in the querystring and thus make them part of the base url for UIWebView. So your URL request would look like file.asp?username=xxx&password=yyy&source=zzz&remember_me=on you would need to change line 7 in your sample file to be source...
You shouldn't pass directly your arrays in the stringWithFormat, you should first convert them into json objects and then pass those json objects (as string representation) to the stringWithFormat NSData *data1 = [NSJSONSerialization dataWithJSONObject:y1Arr options:0 error:NULL]; NSString *y1ArrStr = [[NSString alloc] initWithData:data1 encoding:NSUTF8StringEncoding]; NSData *data2 = [NSJSONSerialization dataWithJSONObject:y2Arr options:0 error:NULL];...
ios,objective-c,iphone,uiwebview
Ok, after a few days debugging and looking at the project again, I've fixed it. And it has been entirely my fault from the start. Stupid me. :P It turns out that I've been making the layout from Compact-w Compact-h size class in the Story board. And when I looked...
javascript,ios,uiwebview,sencha-touch-2
You need to listen to the touchstart event on the component that has the problem and then prevent the touchstart event if the activeElement does not match the target. Example: if (Ext.os.is.iOS) { this.innerElement.on({ scope: this, touchstart: "onTouchStart" }); } onTouchStart: function (e) { if (document.activeElement != e.target) { e.preventDefault();...
ios,objective-c,uiwebview,ios-web-app
Put this code in viewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadWebView:) name:UIApplicationWillEnterForegroundNotification object:nil]; and this code in viewDidUnload [[NSNotificationCenter defaultCenter] removeObserver:self]; ...
javascript,ios,css,uiwebview,scale
My coworker found the answer! Answer: You can't scale an <iframe> from the outside DOM, you have to postMessage() into the <iframe> and use document.body.style.webkitTransform = "scale(1337)" Hope this helps somebody else in need! Credit ultimately goes to http://adexcite.com/iframe_scaling_test.html...
ios,objective-c,xcode,uiwebview
[self.webView reload] - will reload the current page. This is probably happening before the loadRequest has finished. Try removing this line. Also, @joern's comment is correct; the 'event' is the user making a pan gesture. Lose the timer....
ios,objective-c,cocoa-touch,uiwebview
You can not get title of a website before you receive data from the URL. So Set your webview delegate to self Then in - webViewDidFinishLoad: to get title ...
javascript,html,ios,objective-c,uiwebview
I have solved by this : NSMutableArray *array = [[NSMutableArray alloc]initWithObjects:@"'Sudhaadagdudgdada'",@"'qwertyuiopo'",@"'asdfghjkl'", nil]; NSString *html = [NSString stringWithFormat:@"<div id='check'></div><script> var j; var jsArray = new Array %@; str=''; for(j = 0; j< 3; j++){ str += '<input type=\"checkbox\" name=\"one_'+j+'\" value = \"'+jsArray[j]+'\" onclick=\"alert(this.value);\" />'+jsArray[j]+'<br/><br/>'; }...
Just display UIWebView on the IBAction? You're going to want something like this: @IBAction func newAction(sender: UIBarButtonItem) { // set up webview let webView = UIWebView(frame: self.view.frame) // or pass in a CGRect frame of your choice // add webView to current view self.view.addSubview(webView) self.view.bringSubviewToFront(webView) // load the Google Maps...
i find a way to do this,but i think this is not a good way. step 1------use NSURLConnection in override func viewDidLoad(){} section request = NSURLRequest(URL:url) let urlConnection:NSURLConnection = NSURLConnection(request: request, delegate: self)! step 2------ use the NSURLConnection delegate to func connection(connection: NSURLConnection, didFailWithError error: NSError){ println("didFailWithError") } func connection(connection:...
ios,swift,uiwebview,keyboard,inputaccessoryview
import UIKit extension UIViewController { func addNewAccessoryView(oldAccessoryView:UIView) { var frame = oldAccessoryView.frame; var newAccessoryView = UIView(frame:frame) newAccessoryView.backgroundColor = UIColor.lightGrayColor() let fn = ".HelveticaNeueInterface-Bold" var doneButton = UIButton(frame:CGRectMake(frame.size.width-80,6,100,30)) doneButton.setTitle("Done", forState: UIControlState.Normal) doneButton.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal) doneButton.titleLabel!.font = UIFont(name: fn,...
I've done this in the past using UIPrintPageRenderer. It's a more versetile way of creating a PDF from a UIWebView, and it's been working well for me so far. I've tested this solution with Xcode 6 and iOS 8.2. Also, tried printing the resulting PDF and everything printed out fine....
Place the base64 encoded image data in a NSString removing the first part of that string and decode it using NSData: NSString *base64Str = [myString substringFromIndex:22]; NSData *data = [[NSData alloc]initWithBase64EncodedString:base64Str options:NSDataBase64DecodingIgnoreUnknownCharacters]; UIImage* myImg=[UIImage imageWithData:data]; (Works with IOS 7.0 and later)...
ios,iphone,uiwebview,uiscrollview,uikit
We already solved it in the comments, so let's just put this answer for completeness' sake. If you're using Auto Layout, make sure to change the size of the WebView by setting constraints such as a height constraint and changing its constant to make the layout change. If you want...
PDF forms may bring along appearances or may rely on the viewer to create an appearance for the value of the field. Fairly complete PDF viewers (like Adobe Reader or Foxit) can get along with both variants well. Incomplete viewers, though, like many so called previewers, require an existing appearance...
ios,objective-c,html5,video,uiwebview
After a discussion with Apple Support, the problem has been fixed. The problem has to do with the hardware H264 decoder. Basically, I was never removing the videos from the hardware decoder buffer by never releasing the video resources (which I thought javascript would do itself). So I was setting...
ios,objective-c,iphone,uiwebview
Use UIWebViewDelegate's shouldStartLoadWithRequest method to check the URL your web view is trying to load. If URL is not one of the pages you want to allow access to, return false.
ios,objective-c,iphone,uiwebview
To connect to IDN (international domain name) URLs, you need to encode them in Punycode. For example, this URL would be encoded as http://xn--d1abbgf6aiiy.xn--p1ai. Unfortunately I don't know of any built-in punycode support in iOS. But there are third-party tools like NSURL-IDN (which is extracted from the OmniNetworking library)....
javascript,ios,html5,uiwebview
I don't think this can be done using public api. But you can do that using JavaScript like here: How to simulate a mouse click using JavaScript?: function simulate(element, eventName) { var options = extend(defaultOptions, arguments[2] || {}); var oEvent, eventType = null; for (var name in eventMatchers) { if...
request is an optional property on UIWebView: var request: NSURLRequest? { get } also stringByAddingPercentEscapesUsingEncoding returns an optional: func stringByAddingPercentEscapesUsingEncoding(_ encoding: UInt) -> String? What you need is to make user of optional binding in a few places: if let toShorten = webView.request?.URL.absoluteString { if let encodedURL = toShorten.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {...
ios,objective-c,iphone,uiwebview
The parent view was missing the user interaction enabled flag.
ios,objective-c,ipad,uiwebview
The main thing you should know is that you can't have multiple files in your bundle with the same name even if you put them in different directories cause when your code is compiled and converted to an ipa, all your bundle resources will be in the same folder. What...
Hiding a view does not change its size or constraints, so the result you get is expected. You should probably have a height constraint on your table view, and make an IBOutlet to it. When there is no content in the table, modify the constant property of the constraint to...
javascript,ios,objective-c,uiwebview
in case anyone else was wondering about that, the solution was a simple escape character. Thanks everyone. editedSearchString = [editedSearchString stringByReplacingOccurrencesOfString:@"á" withString:@"\\á"]; ...
shouldStartLoadWithRequest() won't get called if you haven't set the web view's delegate. In order to use UIWebView its typically set as an outlet property of a view controller, so you should have something like this: IBOutlet UIWebView* webView; The webView has a delegate property which needs setting to your view...
ios,uiwebview,xamarin,viewport,wkwebview
It turns out that the necessary launch images for the higher-res iPhones were present but not properly included in the iOS project, causing the app to load at the lower resolution of previous iPhones. Once [email protected] and [email protected] files were referenced, the app loaded as expected. Leave it to Apple...
ios,cookies,uiwebview,save,httpcookie
I had such a problem. I tried many ways. I decided use dirty hack :D That's my way: When I was getting NSHTTPURLResponse for facebook (or else) i save request url to NSUserDefaults: - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response; if ([[httpResponse URL].absoluteString isEqualToString:@"http://www.simple.com/"]) { [[NSUserDefaults standardUserDefaults]...
uiwebview,nsurlrequest,wkwebview,nsurlprotocol
After going through a lot of documentation, I realized/learnt that I'll not be able to track URLs if I use WKWebviews. I have to resort to UIWebView for the moment.
css,scroll,uiwebview,mobile-safari,hybrid-mobile-app
You mentioned you aren't using any libraries to do JS scrolling, but it looks like one of the libraries you're including (Polymer I believe) is taking over scrolling. To confirm this, use the Safari Web Inspector and disable javascript - you'll see that your sample page will no longer scroll...
You can't easily get to it but there is a good trick that is well documented here: How to detect and handle HTTP error codes in UIWebView?...
I'm not sure how complicated your use of the UIWebView is but, the quickest implementation I can think of (aside from the evaluateJS route you've already done): Create a property to decide if a request has been hijacked yet (by you). var hijacked = false provide the UIWebViewDelegate protocol method....
ios,xcode,scroll,uiwebview,swipe
This is how I implemented swipe gesture in UIWebView. Add <UIGestureRecognizerDelegate> protocol to ViewController.h In ViewDidLoad Method add the following code: UISwipeGestureRecognizer * swipeGestureDown = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeDown)]; swipeGestureDown.numberOfTouchesRequired = 1; swipeGestureDown.direction = UISwipeGestureRecognizerDirectionDown; swipeGestureDown.delegate = self; [self.webView addGestureRecognizer:swipeGestureDown]; Add Delegate method in ViewController.m :...
Using jQuery to edit all of your images: $(function() { $("img").each(function(){ var filepath = $(this).attr("file"); if (filepath) this.src=filepath; }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <img src="wrongsrc" file="http://www.hi-pda.com/forum/uc_server/data/avatar/000/52/56/39_avatar_middle.jpg"></img> <img src="wrongsrc" file="http://www.hi-pda.com/forum/uc_server/data/avatar/000/52/56/39_avatar_middle.jpg"></img> <img...
ios,swift,cocoa-touch,uiwebview,local-storage
I have now found out that the code in the question does in fact work, all the time on the phone, sometimes in the Xcode iOS simulator. I'm pretty sure it has something to do with the fact that creates new app directories every time you rebuild, but the localStorage...
ios,objective-c,swift,uiwebview
I assume that it is related that programmatically launching keyboard is disabled in Safari. By default, UIWebView doesn't allow either programmatically launching the keyboard. However, you can enable this functionality from the Swift side when you create the UIWebView. Just set keyboardDisplayRequiresUserAction to false. See Apple's documentation for more information...
Did you mean to present the controller as modal? Perhaps it should be pushed on as follows?: - (IBAction)visiteSite:(id)sender { WebViewController *hospitalSite = [self.storyboard instantiateViewControllerWithIdentifier:@"hospitalSite"]; hospitalSite.hospitalWebURL = self.url; [[self navigationController] pushViewController:hospitalSite animated:YES]; } Also you might want to do your frame related code in viewWillAppear or viewDidAppear rather than viewDidLoad,...
ios,objective-c,caching,uiwebview
You may used ASIWebPageRequest , example given here Or If reachability got connectivity NSCachedURLResponse* response = [[NSURLCache sharedURLCache] cachedResponseForRequest:[webView request]]; NSData* data = [response data]; Store data in locally and use it whenever you got reachability offline....
@Ir100, use the same acess_token and secret_key you generated via OAuth Library and just change your request url(API) because every time you have to send other parameter for API call. _consumer = [[OAConsumer alloc] initWithKey: _consumerKey secret: _secretKey]; OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL: url consumer: _consumer token:token realm:nil signatureProvider:...
I made it work. <script type='text/javascript'> document.addEventListener('touchend', function(e) {window.location='js-settarget:runTypeMethod';}, false); that would communicate with objective-c function on magnifying glass up....
Maybe you use zoom mode at your iPhone6/6plus.
ios,objective-c,performance,uiwebview,nsarray
I think using a custom cell with a Web View inside it will be the better. Although whole concept of Web View inside a table view is weird. Inside cellForRowAtIndexPath you would need to do something like: [cell.webView loadHTMLString:HTMLContent baseURL:nil]; The main advantage of Table View is that the number...
I imagine you can get this effect by changing the user agent. That should work with most web sites, unless they are really serious about trying to detect mobile devices (by checking window size, etc)....
NSMutableCharacterSet *characterSet =[NSMutableCharacterSet characterSetWithCharactersInString:@" "]; NSArray *arrayOfComponents = [phone_number componentsSeparatedByCharactersInSet:characterSet]; phone_number = [arrayOfComponents componentsJoinedByString:@""]; NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phone_number]; NSString *escapedUrlString = [phoneURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *phoneURL = [NSURL URLWithString:escapedUrlString]; ...
I fixed it. override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews(); playerWebView.scrollView.contentInset = UIEdgeInsetsZero; } Adding to the edit i made to the question, i forgot swift changes set and get methods for accessor variables as in C#. ...
javascript,ios,objective-c,uiwebview
Ok, so I figured out a good way to do this. In your javascript call add add this line to the end of your script : window.location = 'js-ObjC:jsCompleted'; Then use the UIWebView's shouldStartLoadWithRequest: method in order to capture and test for this new window location. I then called a...
ios,uiwebview,metadata,wkwebview,apple-touch-icon
In Firefox for iOS we use a User Script (Link to code on Github) to find the icon that then passes them back to the application which downloads them using native code (Link to code on Github).
html,ios,objective-c,uiwebview,wkwebview
You have to copy all your web files to the app's NSTemporaryDirectory and call your index.html from there. Works fine on iOS 8.3 for me.
ios,objective-c,iphone,uiwebview,uikeyboard
Please use this category class it will help you. @interface UIWebView (GUIFixes) /** * @brief The custom input accessory view. */ @property (nonatomic, strong, readwrite) UIView* customInputAccessoryView; /** * @brief Wether the UIWebView will use the fixes provided by this category or not. */ @property (nonatomic, assign, readwrite) BOOL usesGUIFixes;...
I think if your html file or string have the url for the image then it will load it automatically you won't have to worry about it. look at your html file and make sure that you get your image url properly in html string.
NSString *htmLData = @" ";//Write your all Response Here NSString *strTemplateHTML = [NSString stringWithFormat:@"<html><head> <style TYPE=\"text/css\"> img{max-width:100%;height:auto !important;width:auto !important;};</style></head><body style=\"margin:10; padding:0;\">%@</body></html>",htmLData]; [self.webView loadHTMLString:strTemplateHTML baseURL:nil]; ...
swift,ios5,uiwebview,touch-event
If you want to call a function while tapping a view you can use UITapGestureRecognizer override func viewDidLoad() { super.viewDidLoad() let tapRecognizer = UITapGestureRecognizer(target: view, action: "handleSingleTap:") tapRecognizer.numberOfTapsRequired = 1 self.view.addGestureRecognizer(tapRecognizer) } func handleSingleTap(recognizer: UITapGestureRecognizer) { //Do something here } ...
javascript,ios,swift,uiwebview
To fake a onclick event from javascript you need to do something like this.. var aTag = document.createElement('a'); aTag.setAttribute('href',"http://www.google.com"); aTag.innerHTML = "link text"; aTag.click() the above code will hit the UIWebViewNavigationType.LinkClicked window.open("http://www.w3schools.com"); the above code will trigger UIWebViewNavigationType.other...
I was able to do what I need it to do by using Notifications. I dont know if this is the best way of doing it by it worked for me. I hope this could be useful to someone else. In ViewController1.m - (void)viewDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"TestNotification"...
ios,swift,uiwebview,nsurl,nsurlrequest
The problem is that you do not know what is nil. Add more logging, like this: let url = NSURL(string: "http://www.urartuuniversity.com/content_images/pdf-sample.pdf")! let request = NSURLRequest(URL: url) println(url) println(request) println(webView) webView.loadRequest(request) In this way, by putting your app through its paces and trying to reproduce the crash, you will discover, just...
Why not just use a UIWebViewController ,and tell the Cell to push a new WebViewController in a tap action.
swift,url,uiwebview,uitextfield
webView.request is optional, so you’re using optional chaining. You just need to do the same with the request’s URL, which is also optional: self.addressBar.text = self.webView.request?.URL?.absoluteString Note, there’s no need to force-unwrap this with the ! on the end. This is because self.addressBar.text is itself of type String?....
ios,objective-c,ipad,uiwebview,screen-orientation
I realized on that before IOS 8 The values of Screen size returned did not change according to the orientation of the App but from IOS8 onwards it does. Basically wherever I was calling CGRectMake to Create the rectangle I was using the wrong values of Height and Width to...
The issue you're having is that self.view.bounds has most likely not been adjusted yet to the bounds after rotation. Set a breakpoint to check this out. I would move the code to viewDidLayoutSubviews: instead. If you don't need to support versions of iOS before iOS 6, I'd strongly recommend looking...
You could call stringByEvaluatingJavaScriptFromString and pass the appropriate javascript to emulate the key press. For the javascript see e.g. this answer....
ios,objective-c,authentication,uiwebview
It seems you are extremely new to iOS so I'll help you out here a little. First off, you should never jump back into the App Delegate to reset views. You want to load the MainViewController inside your app delegate like you are currently doing. The rest of the code...
ios,caching,uiwebview,nsurlcache
I ended up creating a method similar to the NSURLConnectionDelegate method willCacheResponse, and replacing the Cache-Control:private header. willCacheResponse method func willCacheResponse(cachedResponse: NSCachedURLResponse) -> NSCachedURLResponse? { let response = cachedResponse.response let HTTPresponse: NSHTTPURLResponse = response as NSHTTPURLResponse let headers: NSDictionary = HTTPresponse.allHeaderFields var modifiedHeaders: NSMutableDictionary = headers.mutableCopy() as NSMutableDictionary modifiedHeaders["Cache-Control"] =...
ios,xcode,swift,uiwebview,exc-bad-access
So I just realized that, for some reason, my segue was running off the main thread. Dispatching to the main queue fixed the issue.
pdf,ios8,uiwebview,nsdocumentdirectory,writetofile
Okay, after mucking about I found that since the documents directory changes path every time I run the app, I had to: Write the file to the documents folder with the complete path to the file: NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask ,YES ); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString...
javascript,html,ios,objective-c,uiwebview
and an objective c solution: @interface ViewController () <UIWebViewDelegate> @property (weak, nonatomic) IBOutlet UIWebView *webView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://yourwebsite.com"]]]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; if ([userDefaults objectForKey:@"contentOffset"]) { webView.scrollView.contentOffset =...
php,cookies,uiwebview,mobile-safari
Is the domain AND the protocol http / https the same? Cookies for http://example.com and https://example.com can be different. Also be wary with subdomains, maybe sub.example.com cookies can be not visible at example.com. You should check (I think you did, but if not, then do), if you have cookies enabled...
ios,iphone,uiwebview,uiwebviewdelegate
The main reason is because, when you invoke the first time URL request, the server on the receiving end tries to display the information as per the requested device browser, ( like mobile, desktop). This is where you see a bit of delay. The server take some time to resolve...