Tag: 快速

WKWebView在safari中打开某个域的链接

寻找一些帮助我的iOS应用程序。 在我的应用程序中,我希望打开WKWebView中来自我的域(EX:communionchapelefca.org)的点击链接,然后在Safari中打开所有其他域(EX:google.com)的链接。 我宁愿这样做编程,因为这是我的代码是如何设置的。 我已经find了一些解决scheme( 在这里 , 这里 , 这里 , 这里 ),但他们都似乎是Obj-C的基础,我正在寻找一个解决scheme,使用Swift。 提前致谢。 ViewController.swift: import UIKit import WebKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let myWebView:WKWebView = WKWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)) myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.communionchapelefca.org/app-home")!)) self.view.addSubview(myWebView)

如何知道两个表情符号是否会显示为一个表情符号?

表情符号👍🏼由2个unicodeScalar👍U + 1F44D,🏼U + 1F3FC组成。 这怎么能被识别为1'显示'的表情符号,因为它会在iOS上显示?

表格视图单元格中的UIButton动作

我正在试图在表视图单元格中按下button的操作。 以下代码在我的表视图控制器类中。 在我的UITableViewCell类叫做requestsCell的sockets中,button被描述为“是”。 我正在使用Parse保存数据,并希望按下button时更新对象。 我的objectIds数组工作正常,cell.yes.tag也打印正确的号码的日志,但是,我不能把这个号码到我的“连接”function,以正确运行我的查询。 我需要一种方法来获取单元格的indexPath.row来find适当的objectId。 override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as requestsCell // Configure the cell… cell.name.text = requested[indexPath.row] imageFiles[indexPath.row].getDataInBackgroundWithBlock{ (imageData: NSData!, error: NSError!) -> Void in if error == nil { let image = UIImage(data: imageData) cell.userImage.image = image }else{ println("not working") […]

检测iOS UIDevice方向

我需要检测什么时候该设备是纵向的,以便我可以发射一个特殊的animation。 但是我不希望我的观点自动化。 当设备旋转到肖像时,如何覆盖视图自动旋转? 我的应用程序只需要在横向上显示它的视图,但是如果我想能够检测旋转到纵向,我似乎还需要支持纵向。

快速拨打电话号码

我试图拨打一个不使用特定号码的电话号码,而是拨打一个在variables中被呼叫的号码,或者至less告诉他们在您的电话号码中input号码。 这个在variables中被调用的数字是我通过使用parsing器或从网站sql获取的数字。 我做了一个button试图调用存储在variables中的电话号码与function,但无济于事。 任何事情都会帮助谢谢! func callSellerPressed (sender: UIButton!){ //(This is calls a specific number)UIApplication.sharedApplication().openURL(NSURL(string: "tel://######")!) // This is the code I'm using but its not working UIApplication.sharedApplication().openURL(NSURL(scheme: NSString(), host: "tel://", path: busPhone)!) }

如何正确使用iOS(Swift)SceneKit SCNSceneRenderer unprojectPoint

我正在iOS上开发一些使用SceneKit的代码,在我的代码中,我想确定全局z平面上的x和y坐标,其中z是0.0,x和y是从轻击手势确定的。 我的设置如下: override func viewDidLoad() { super.viewDidLoad() // create a new scene let scene = SCNScene() // create and add a camera to the scene let cameraNode = SCNNode() let camera = SCNCamera() cameraNode.camera = camera scene.rootNode.addChildNode(cameraNode) // place the camera cameraNode.position = SCNVector3(x: 0, y: 0, z: 15) // create and add an ambient […]

如何在swift下载文件?

我刚刚开始学习iOS的苹果swift编程来自android。 我现在基本上可以读取和操作swift代码,并且学习了一些在iOS Swift编程中使用的常用类,但仍然对语法和一切都有一些困惑。 我正试图下载文件。 就像我们刚刚说的,来自这个URL var url = "http://www.mywebsite.com/myfile.pdf" 在button点击。 也许还有视觉上的进步 通过在这里searchstackoverflow,我偶然发现了Alamofire。 我可能会尝试,但我不知道这是否是我做这件事的最好方法。 所以,我想问一下我的select(iOS7和iOS8)在实现我的目标方面是怎样的,什么是我的select。 此外,利弊将是可怕的!

在Xcode 8中隐式解包可选分配

在Xcode 8发布版本中,我发现了一个奇怪的场景。 这里是代码, let implicitlyUnwrappedOptionalString: String! = "implicitlyUnwrappedOptionalString" let foo = implicitlyUnwrappedOptionalString print(implicitlyUnwrappedOptionalString) print(foo) 这是结果: implicitlyUnwrappedOptionalString Optional("implicitlyUnwrappedOptionalString") 这些上面显示,当我分配一个隐式unwrapped可选的variables没有显式的types,types将被推断为一个可选的types,而不是它原来的types,又名隐式unwrapped可选 。 我的Xcode已经更新到8.任何人都可以validation在Xcode 7.x中的行为? 更改是由于Swift版本更改或Xcode?

NSURLConnection sendAsynchronousRequest无法从闭包中获取variables

我试图从一个PHP页面使用POST获取简单的文本响应。 我有以下代码: func post(url: String, info: String) -> String { var URL: NSURL = NSURL(string: url)! var request:NSMutableURLRequest = NSMutableURLRequest(URL:URL) var output = "Nothing Returned"; request.HTTPMethod = "POST"; var bodyData = info; request.HTTPBody = bodyData.dataUsingEncoding(NSUTF8StringEncoding); NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()){ response, data, error in output = (NSString(data: data, encoding: NSUTF8StringEncoding))! } return output } 虽然这个代码不会抛出任何错误,但是当我这样打电话给它时: println(post(url, info: […]

AESencryption和解密

我用swift编写应用程序,我需要AESencryption和解密function,我从另一个.Net解决scheme接收到encryption的数据,但是我找不到要做的事情。 这是我的.netencryption: public static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes) { byte[] encryptedBytes = null; byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; using (MemoryStream ms = new MemoryStream()) { using (RijndaelManaged AES = new RijndaelManaged()) { AES.KeySize = 256; AES.BlockSize = 128; var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, […]