swift3

swift how to execute javascript after anjular have rendered the page?

一笑奈何 提交于 2019-12-23 05:08:14
问题 In my ios app, I used WKWebview.evaluateJavaScript() to execute javascript to get a div boundingRect. In my webpage, I used anjularjs to render part of my page, the page contents is as, <body ng-app="home" ng-controller="HomeController" style="min-height:700px;"> <printerinfo></printerinfo> </body> <div id="movie" style="border: 1px grey dotted; width: 120px; height: 90px;"></div> swift func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { self.wk.evaluateJavaScript("var

Rotate only between landscapeLeft and landscapeRight

守給你的承諾、 提交于 2019-12-23 05:07:33
问题 I have vidoe playing in landscape mode. And the view only rotate between landscapeLeft and landscapeRight when the device orientation changes. That's to say there is no portrait mode when playing the movie. What's more apart from the movie view, other views are portraint mode, so the app config is portrait. How can I make the movie view only rotate in the landscape mode. Here is a part of my code. appdelegate, internal var shouldRotate = false func application(_ application: UIApplication,

Firebase iOS Swift fatal error: NSArray element failed to match the Swift Array Element type

时光毁灭记忆、已成空白 提交于 2019-12-23 05:00:32
问题 I am trying to fetch data from firebase database the format of data is below. { "chits": { "Chit-1": { "Bidders": [ { "bankAccNumber": "5555566966", "bankIFSC": "GFHJJHHJ", "bankName": "55666", "bidderEmail": "desi@venkat.co.in", "bidderId": "Bidder-1", "bidderName": "Venkat Desi", "bidderPhone": "9999999999", "checked": false, "paymentType": 66555 }, { "bankAccNumber": "5555566966", "bankIFSC": "GFHJJHHJ", "bankName": "55666", "bidderEmail": "desi@venkat.co.in", "bidderId": "Bidder-2",

UIView center position during animation

≡放荡痞女 提交于 2019-12-23 04:49:13
问题 I would like to determine, what is the center position of a UIVIew (the middle point of the view) during an animation. An animation with UIViewPropertyAnimator like this: let animator = UIViewPropertyAnimator(duration: 10, curve: .easeInOut) var circle : UIView! circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 40.0, height: 40.0)) circle.layer.cornerRadius = 20.0 circle.backgroundColor = UIColor.blue self.view.addSubview(circle) animator.addAnimations { circle.center = CGPoint(x: 100,y:

How can i show in Google Map the nearest places to my location?

岁酱吖の 提交于 2019-12-23 04:48:10
问题 Im trying to create an iOS App, i'm not entirely sure about a few things with swift by now, but i´m still learning every day! My question is... How can i show in Google Map the nearest places to my location?! Im getting an array from mysql DB with Latitude & Longitude, but i can't (i have no idea) how to place those selected records in my map! (i mean a determined radius from my location) would somebody help me please?! iOS #MySQL #JSON #GoogleMapsSDK #Swift3 I'm using AlamoFire & Swifty PODs

Trouble refreshing Spotify token iOS SDK

蓝咒 提交于 2019-12-23 03:59:27
问题 I'm confused as how I use the refresh token service. In my app there is a section with many playlists. When the user clicks on the playlist it runs this code: func checkAuth() { print("checking auth") let auth = SPTAuth.defaultInstance() //print(auth!.session.isValid()) if auth!.session == nil { print("no auth") if auth!.hasTokenRefreshService { print("refresh token if session == nil") self.renewTokenAndShowPlayer() return } else { self.performSegue(withIdentifier: "LoginControllerSegue",

Swift 3 and JSON – Updating the database by running a URL in the background

青春壹個敷衍的年華 提交于 2019-12-23 03:17:08
问题 1. Clicking the link causes a database update. There is a certain link I have access to (let's pretend it's www.google.com), such that when I open it up in my browser, it updates a certain section of the JSON code in my database. Based on the numbers that make up a portion of the link, it adjusts a certain value in the data. 2. How do I run this link in the background of my iOS app? I need to be able to "open" this link within the app, without actually opening up a UIWebview and visually

How to exit a runloop?

北城余情 提交于 2019-12-23 03:06:24
问题 So, I have a Swift command-line program: import Foundation print("start") startAsyncNetworkingStuff() RunLoop.current.run() print("end") The code compiles without error. The async networking code runs just fine, fetches all its data, prints the result, and eventually calls its completion function. How do I get that completion function to break out of above current runloop so that the last "end" gets printed? Added: Replacing RunLoop.current.run() with the following: print("start") var

How to exit a runloop?

独自空忆成欢 提交于 2019-12-23 03:06:18
问题 So, I have a Swift command-line program: import Foundation print("start") startAsyncNetworkingStuff() RunLoop.current.run() print("end") The code compiles without error. The async networking code runs just fine, fetches all its data, prints the result, and eventually calls its completion function. How do I get that completion function to break out of above current runloop so that the last "end" gets printed? Added: Replacing RunLoop.current.run() with the following: print("start") var

filterTableViewController.reloadRows reloading rows only on first call

筅森魡賤 提交于 2019-12-23 02:38:38
问题 I have a table with 3 rows each with check button.What I am doing is when I select all the three buttons I want to click my cancel button which is on view not table on same controller to reload all 3 rows the call goes to custom cell class where uncheck is set to true and rows are reloaded.For the first attempt it works fine I can see correct index to be reloaded.On the second time again when I select all 3 check buttons and click cancel again I can see correct index to be reloaded but the