Tag: 快速

file upload进度问题

我使用AFNetworking在表格视图单元格中上传单个文件。 上传工作正常。 但是,当我从视图中滚动我的单元格时,进度消失了,或者显示了不同的进度值,例如20%或50%,以及30%。 这是我的代码: //Tableview Cell configure var cell : ChattingPhotoCell! if message.vendorType == .Receiver { //Receive Image message cell = tableView.dequeueReusableCell(withIdentifier: "ReceiveChattingPhotoCell") as! ChattingPhotoCell if cell == nil { cell = Bundle.main.loadNibNamed("ReceiveChattingPhotoCell", owner: self, options: nil)?[0] as! ChattingPhotoCell } cell.reloadDelegate = self cell.mDelegate = self cell.accessoryType = cell.isSelected ? .checkmark : .none cell.conficureImageCell(msg: message,indexPath: […]

为select器传递UItapgestureRecognizer的额外参数

我有两个标签,Label1和Label2。 我想做一个单一的函数,打印出哪个标签是通过创buildUITTapRecognizer来为这两个标签调用与传递参数的select器相同的函数。 下面是做这个很混乱,但工作的漫长的道路。 如果我知道如何将一个参数(Int)传递给select器,它将会非常干净。 let topCommentLbl1Tap = UITapGestureRecognizer(target: self, action: #selector(DiscoverCell().doubleTapTopComment1)) topCommentLbl1Tap.numberOfTapsRequired = 2 topCommentLbl1.userInteractionEnabled = true topCommentLbl1.addGestureRecognizer(topCommentLbl1Tap) let topCommentLbl2Tap = UITapGestureRecognizer(target: self, action: #selector(DiscoverCell().doubleTapTopComment2)) topCommentLbl2Tap.numberOfTapsRequired = 2 topCommentLbl2.userInteractionEnabled = true topCommentLbl2.addGestureRecognizer(topCommentLbl2Tap) func doubleTapTopComment1() { print("Double Tapped Top Comment 1") } func doubleTapTopComment2() { print("Double Tapped Top Comment 2") } 有没有办法来修改select器方法,以便我可以做类似的事情 func doubleTapTopComment(label:Int) { if […]

工作可靠的时间戳function只是导致EXC_BAD_INSTRUCTION

我一直在使用这个函数来生成一个时间戳。 我发现它在堆栈溢出的地方。 @objc public class var timestamp: String { return "\(Int(NSDate().timeIntervalSince1970 * 1000))" } 它一直没有问题,但我刚刚得到了一个EXC_BAD_INSTRUCTION: fatal error: floating point value cannot be converted to Int because it is greater than Int.max 随着这个应用程序的发展接近完成,它让我很紧张,突然看到它导致EXC_BAD_INSTRUCTION。 这是在模拟器中运行,但我有一个有效的date和时间设置。 任何想法或build议或不胜感激。 以下是回溯。 (lldb) bt * thread #1: tid = 0x15c4d, 0x04a30393 libswiftCore.dylib`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = […]

使用TDD在Swift中进行性能testing

在Swift学习Test Driven Development 。我在“ProjectNameTests”组中创build了一个XCTestCase子类。 class BasicFunctionTest: XCTestCase { var values : [Int]? override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each […]

领域与RLMException崩溃:对象已被删除或无效

我有一个存储时间线的领域模型(我正在制作video编辑应用程序),而且经常碰到访问它的RMArray属性。 该应用程序已经发货,我没有经历过自己,但我crushlytics通知我经常这样的崩溃。 这是崩溃日志: Fatal Exception: RLMException Object has been deleted or invalidated. Thread : Fatal Exception: RLMException 0 CoreFoundation 0x2614d45f __exceptionPreprocess + 126 1 libobjc.A.dylib 0x3407ec8b objc_exception_throw + 38 2 VideoEditor 0x00293919 RLMGetArray(RLMObjectBase*, unsigned int, NSString*) (RLMRealm_Private.hpp:38) 3 VideoEditor 0x0018a1b4 VideoEditor.RLMProject.setTimeLineModel (VideoEditor.RLMProject)(VideoEditor.TimeLineModel, beginWriteTransaction : Swift.Bool) -> () (RealmModels.swift:147) 4 VideoEditor 0x0025eb9c VideoEditor.VideoEditorAPI.saveProject (VideoEditor.VideoEditorAPI)(Swift.Optional<VideoEditor.IProject>, timeLine : […]

Swift – 由currentCalendar()当前位置的Weekday

今天是星期三,我有这个代码 let calendar:NSCalendar = NSCalendar.currentCalendar() let dateComps:NSDateComponents = calendar.components(.CalendarUnitWeekday , fromDate: NSDate()) let dayOfWeek:Int = dateComps.weekday dayOfWeek是4,但今天是在保加利亚一周的第三天。 今天在美国是一周的第四天吗? 以及如何确定一周在不同国家和地区开始的时间? 在我的iPhone语言环境和日历设置为保加利亚日历和语言环境,它知道星期一开始我的iMac也,但是当我执行代码它写我4 …

Xcode 8 Swift 3应用程序是否成功运行在iOS 7上?

Xcode 8 Swift 3应用程序是否成功运行在iOS 7上? 我试图确定这个运行下面描述的几个testing,但是能更好地了解App Store开发的专家能帮助解释成功和失败的原因,包括下面的问题吗? testing1。 所以我打开了Xcode 7.3.1,并用Swift 2.2创build了一个应用程序。 我打算从iOS 7到iOS 10部署应用程序。 我在iOS 9.3 iPhone模拟器上成功运行应用程序,然后在实际的iOS 7.1.2 iPhone设备上成功运行应用程序。 testing2。 接下来,我已经采取了相同的项目,并在Xcode 8 Beta 2中打开它。(我被提示更新到Swift 2.3或Swift 3.我更新到Swift 2.3,然后更新到Swift 3.) 在手动inputiOS Target Deployment 7.0后,我成功运行iOS 10 Beta 2 iPhone模拟器上的应用程序。 然而,我然后尝试在实际的iOS 7.1.2 iPhone设备上运行应用程序,但这次没有成功,显示下面的错误。 我用Swift 2.3和Swift 3重复了这个testing,发生了同样的错误: 找不到设备支持文件 这个iPhone 4S运行iOS 7.1.2(11D257),这个版本的Xcode 可能不支持。 testing3。 所以接下来我尝试在获取应用程序的存档(产品>存档…)之后,将通过iTunes直接在Xcode 8 Beta 2中创build的.ipa应用程序文件安装到实际的iOS 7.1.2 iPhone设备上。 .ipa应用程序文件完成通过iTunes传输到iOS […]

更改用户代理

如何在WebView中更改User-Agent的默认string? @IBOutlet weak var myWbView: UIWebView! let myURL = NSURL(string: "http://http://web-example") let myURLRequest:NSURLRequest = NSURLRequest(URL: myURL!) myWbView.loadRequest(myURLRequest)

如何从Xcode 8中的Assets.xcassets添加不同屏幕大小的图片?

我为我的login屏幕创build不同大小的背景图像。 我指的是苹果链接https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/ 但我没有做启动屏幕,我只是想添加背景login屏幕。 我想知道哪个是1x,2x和3x? 另一个问题是当我创build图像集,图像的大小应该拖到哪个地方。 我不知道这件事。 或者我们只需要3张图片(通用行)? 那么,如何为景观图像? 我应该把这个放在哪里?

自动布局如何在一个视图中隐藏1个视图,3个等宽视图

目前我有1视图内的3个视图(这是固定在超视图的前沿和后沿)。 目前3个视图是这样的: 但是,在某些情况下,我希望隐藏靛蓝色的视图,但是仍然保留最后2个像这样的宽度: 我怎样才能实现这一点与自动布局? 或者我怎样才能达到这个使用IBOutlets约束?