Tag: swift3

Swift 3中的Microsoft Azure远程通知

我正在使用Swift 3.0在Xcode 8.2.1中使用iOS应用程序。 我想这个应用程序能够接收使用Microsoft Azure的远程推送通知。 不过,我在执行这个时遇到了麻烦。 我发现的大多数指南都是针对Swift的旧版本的,不再适用。 我唯一能find的版本是这个 。 但是,这似乎也不工作。 我跟着指南,但得到了以下错误: Undefined symbols for architecture armv7: "_OBJC_CLASS_$_AEIdfaProvider", referenced from: objc-class-ref in libengagement.a(AEDeviceIDManager.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) 我相信类AEIdfaProvider无法find,即使它包含在项目中。 如果有人可以提供一个线索来解决这个问题,或者如果有另一个指导,我可以给一个镜头,我会很高兴听到!

如何在Swift中的自定义类中初始化Timer?

我做了一个简单的计时器应用程序,但是,现在我想让它变得更好,我想写一个用于计时器控制的类: class Cronometer{ private var counter:Int = 0 private var timer:Timer = Timer() private var state:Bool = true func initCronometer(){ if self.state{ self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: Selector("onTick"), userInfo: nil, repeats: true) }else{ self.timer.invalidate() } self.state = !self.state } func onTick(){ self.counter += 1 print(self.counter) } } 但是select器参数不是在类中使用自定义方法。 我不希望它在ViewController里面,就像我以前所做的那样。 我尝试着 self.timer = Timer.scheduledTimer(timeInterval: […]

在IOS上,寻找选项来检测当前位置在谷歌地点sdk

我不熟悉Swift3,但是我从自由职业者开发我的应用程序,但他们说,他们不能够添加检测当前位置在谷歌地点api sdk执行在我的IOS应用程序开发swift3search地址。 我正在尝试执行我的地址search页面,如下所示 在这个function的任何指针将是一个很大的帮助。 请分享我可以与开发人员分享的这种实现的任何示例/教程来实现。

Swift 3项目中的Unity实现:应用程序启动崩溃 – MetadataCache :: Initialize()

各位程序员, 我需要实现一个导出的Unity项目到我的本地Swift项目,所以我按照本教程的说明: https://github.com/blitzagency/ios-unity5 不幸的是,应用程序启动崩溃。 我截取了我的debugging导航器的截图: 我发现这个线程,并遵循每一个build议,但我不能得到它的运行。 我会很高兴看到一个工作的例子: https://forum.unity3d.com/threads/il2cpp-anyone-else-seeing-metadatacache-initialize-crashes-sometimes-when-the-game-starts.383145/ 提前致谢。

如何使用单选button隐藏表视图中的部分?

在这里,我有四个部分在表视图中,但在第一节所有单元格都有单选button。 每当它处于活动状态,我需要显示剩余的三个部分,如果不是,我需要隐藏剩下的最后三个部分,任何人都可以帮助我如何实现这一点? 图像如下所示 ? @IBAction func selectRadioButton(_ sender: KGRadioButton) { let chekIndex = self.checkIsRadioSelect.index(of: sender.tag) if sender.isSelected { } else{ if(chekIndex == nil){ self.checkIsRadioSelect.removeAll(keepingCapacity: false) self.checkIsRadioSelect.append(sender.tag) self.ProductTableView.reloadData() } } } func numberOfSections(in tableView: UITableView) -> Int{ return 4 } func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { if (section == 0){ return "PAYMENT […]

UILabel上的文本填充

在这里,我正在尝试在文本周围添加一些填充(左,右,上,下)的标签。 这个问题在SOF上有相关的post,在阅读了其中的一些之后,我试着使用这里提出的一个解决scheme: 这是我的子类UILabel的代码: import UIKit class LuxLabel: UILabel { //let padding: UIEdgeInsets var padding: UIEdgeInsets = UIEdgeInsets.zero { didSet { self.invalidateIntrinsicContentSize() } } // Create a new PaddingLabel instance programamtically with the desired insets required init(padding: UIEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)) { self.padding = padding super.init(frame: CGRect.zero) } // Create […]

UIPanGestureRecognizer没有启动。 Swift 3

我的视图层次如下: 视图 查看用户的Img + Emoji(A) 与UI元素的视图。 (B) 在viewDidLoad中,我为emojis创buildUIImageViews,将它们添加到A并添加手势识别器(平移,缩放,旋转): let emojiView = UIImageView(image: emoji) emojiView.tag = n emojiView.frame = CGRect(x: 153, y: 299, width: 70, height: 70) emojiView.isUserInteractionEnabled = true let pan = UIPanGestureRecognizer(target: self, action: #selector(self.handlePan(recognizer:))) pan.delegate = self emojiView.addGestureRecognizer(pan) let pinch = UIPinchGestureRecognizer(target: self, action: #selector(self.handlePinch(recognizer:))) pinch.delegate = self emojiView.addGestureRecognizer(pinch) let rotate = UIRotationGestureRecognizer(target: […]

UITableView中的单元格重叠。 许多细胞在一个地方

我试图用随机数字的标签进行表视图。一切工作,直到我试着滚动它。 比许多细胞出现在一个地方。 它看起来像这样: 从模拟屏幕 为了使viewDidLoad()中的随机行高度我把这个: tableView.estimatedRowHeight = 50.0 tableView.rowHeight = UITableViewAutomaticDimension 用随机数行写随机数的标签的代码在这里: override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "HarvestPlan", for: indexPath) as! HarvestPlanCell let currentSpecies = harvestPlan[indexPath.row] var kindLabels = [UILabel]() cell.kindsNamesView.bounds.size.width = 100 for kind in currentSpecies.kinds { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false […]

为什么alamofire下载警报的进度会闪烁,后面的屏幕开始变黑?

在使用alamofire下载时,我有警告的进度视图,但是问题是,当我想要下载alert时的进度视图将会开始完成,但闪烁,另一个问题是后面的屏幕将开始淡化为黑色每秒钟都会有一个新的提示,进度视图会显示,最后有很多提醒,我怎样才能避免它们? downloadTimer = Timer.scheduledTimer(timeInterval: 1 , target: self, selector: #selector(flashingDownload), userInfo: nil, repeats: true) let destination = DownloadRequest.suggestedDownloadDestination() Alamofire.download("http://example.com", to: destination).downloadProgress(queue: DispatchQueue.global(qos: .utility)) { (progress) in print("Progress: \(progress.fractionCompleted)") sixthLevelViewController.progressdownload = Float(progress.fractionCompleted) if sixthLevelViewController.progressdownload == 1.0 { self.downloadfinished = true let alertController = UIAlertController(title: "finish download ", message: " download Completed! ", preferredStyle: UIAlertControllerStyle.alert) let okAction […]

从相机UIImage旋转90度 – 使用扩展名

当图像数据返回并应用于UIImage时,如果数据来自相机,则图像会旋转90度。 我尝试添加 extension UIImage { func correctlyOrientedImage() -> UIImage { if self.imageOrientation == UIImageOrientation.up { return self } UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) self.draw(in: CGRect(origin: CGPoint(x: 0,y :0), size: CGSize(width: self.size.width, height: self.size.height)) ) let normalizedImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext(); return normalizedImage; } } 在我的代码中,我检查是否为特定用户保存了数据,如果是这样,我将图像数据加载到UIImageView的profile_image中。 //profile_image if let profile_imager = UserDefaults.standard.object(forKey: String(UserID)) as? Data { let data = […]