Tag: Swift ios8

如何延迟下一个动作,直到runBlock完成后? (迅速)

在runBlock内部不会遵循moveTo的duration属性,从而允许序列中的后续操作在duration秒后才能被执行。 代码A(顺序执行正确): let realDest = CGPointMake(itemA.position.x, itemA.position.y) let moveAction = SKAction.moveTo(realDest, duration: 2.0) itemB.runAction(SKAction.sequence([SKAction.waitForDuration(0.5), moveAction, SKAction.runBlock { itemB.removeFromParent() }])) 代码B(序列没有正确执行): let badMoveAction = SKAction.runBlock { let realDest = CGPointMake(itemA.position.x, itemA.position.y) let moveAction = SKAction.moveTo(realDest, duration: 2.0) itemB.runAction(moveAction) } itemB.runAction(SKAction.sequence([SKAction.waitForDuration(0.5), badMoveAction, SKAction.runBlock { itemB.removeFromParent() }])) 在Code A , itemB在moveAction完成后被移除(大约2秒)。 这是正确的顺序。 在Code B , itemB在badMoveAction完成之前被移除,这意味着itemB永远不会从原始位置移开。 这就好像Code B的持续时间属性不受尊重。 […]

iOS 8.4 – iboutlet不能以编程方式创build视图控制器

当在iOS 8.4中以编程方式加载UIViewController时,我始终将注册为IBOutlets为零。 这是在任何iOS 8.4设备上导致崩溃。 完全相同的代码在iOS 9和9.0.1上运行平稳。 作为参考,这是视图控制器的一个片段 class B8AVPermissionsViewController: B8BaseViewController { @IBOutlet weak var closeButton: UIButton! @IBOutlet weak var cameraButton: UIButton! @IBOutlet weak var microphoneButton: UIButton! var delegate: B8PermissionRequestingDelegate? = nil; override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated); NSLog("cameraButton: \(cameraButton)") } 打印出cameraButton: nil […]

使用CTGetSignalStrength()计算IOS信号强度

我已经开始开发iOS 8.3的非Apple商店应用程序,用于测量并返回以dB为单位的接收信号强度指示(RSSI)值。 我有权访问名为VAFieldTest的Xcode项目的git存储库,该项目使用核心电话框架来访问诸如单元ID,服务mnc,RSSI等信息。但是,项目的构build失败并返回以下内容错误: Ld /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator/VAFieldTest.app/VAFieldTest normal i386 cd /Users/rajesh/Documents/VAFieldTest export IPHONEOS_DEPLOYMENT_TARGET=4.0 export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator -F/Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/PrivateFrameworks -filelist /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Intermediates/VAFieldTest.build/Debug-iphonesimulator/VAFieldTest.build/Objects-normal/i386/VAFieldTest.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreTelephony -weak_framework VoiceServices -Xlinker -dependency_info -Xlinker /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Intermediates/VAFieldTest.build/Debug-iphonesimulator/VAFieldTest.build/Objects-normal/i386/VAFieldTest_dependency_info.dat -o /Users/rajesh/Library/Developer/Xcode/DerivedData/VAFieldTest-dmyrokwehbyuqcauvwpiouivlnqy/Build/Products/Debug-iphonesimulator/VAFieldTest.app/VAFieldTest ld: -pie can only be used when targeting […]

UISearchBar在导航栏半透明= false时超出屏幕界限

我尝试添加UISearchBarController到tableView,但是当我设置UINavigationBar.appearance()。translucent = false然后UISearchBar隐藏在屏幕之外 在TableViewController中 var resultSearchC: UISearchController = UISearchController() override func viewDidLoad() { super.viewDidLoad() self.resultSearchC = ({ let c = UISearchController(searchResultsController: nil) c.searchResultsUpdater = self c.searchBar.translucent = true c.searchBar.barTintColor = .redColor() c.searchBar.sizeToFit() self.tableView.tableHeaderView = c.searchBar return c })() // self.edgesForExtendedLayout = .None self.tableView.reloadData() } AppDelegate中: let navBarAppearance = UINavigationBar.appearance() navBarAppearance.barStyle = .Black navBarAppearance.translucent = false

在Swift中连接string

我有一个数组,其中包含string即数组 我试图连接string,但我得到一个错误,因为“ string是不一样的UInt8 ” var titleString:String! = "" for title in array { titleString += "\(title)" }

如何用swift使用MBProgressHUD

这里是我的代码,但它显示了进展。 这个代码有没有错误? 请给一些想法来解决这个问题,或者给一些相关的链接。 class Approval: UIViewController { var hud: MBProgressHUD = MBProgressHUD() override func viewDidLoad() { super.viewDidLoad() fetchData() } func fetchData(){ hud.show(true) // doing some http request dispatch_async(dispatch_get_main_queue()) { hud.hide(true) } } }