手机版
热门标签
站点地图
我要投稿
广告合作
联系我们
搜 索
广告位招租
广告位招租
切换导航
首页
编程教程
编程导航
编程百科
编程问答
编程博文
编程实例
硬件设备
网络运营
软件教程
移动数码
办公软件
操作系统
人工智能
栏目导航
▸ 编程语言
▸ 前端开发
▸ 移动开发
▸ 开发工具
▸ 程序设计
▸ 行业应用
▸ CMS系统
▸ 服务器
▸ 数据库
公众号推荐
微信公众号搜
"智元新知"
关注
微信扫一扫可直接关注哦!
子栏目导航
iOS
Android
Swift
Hybrid
Cocos2d-x
Flutter
Xcode
Silverlight
cocoa
Cordova
编程之家
Swift
[Swift]LeetCode829. 连续整数求和 | Consecutive Numbers Sum
Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? Example 1: Input: 5 Output: 2 Explanation: 5 = 5 = 2 + 3 Example 2: Input: 9 Output: 3 Explanat
作者:编程之家 时间:2020-08-11
在swift中向下滑动时搜索栏
我正在为iOS开发一个社交媒体应用程序 我的ViewControllers目前嵌入在NavigationController中. 在我的新闻提要屏幕上,我需要在用户向下滑动时显示搜索栏(并在他向上滑动时隐藏它),其中如果用户输入内容,搜索结果将显示在新闻提要屏幕的顶部. 我试图修补这个,但我对iOS很新,到目前为止还没有设法让它工作. 任何帮助都会受到赞赏,请记住,我只对iOS进行了几周的编程,因
作者:编程之家 时间:2020-08-11
swift – Mac托盘应用程序的全局键盘快捷键
我正在使用 Swift 4开发一个Mac应用程序,它只作为代理程序运行(它只在托盘中有一个菜单).我对Swift完全不熟悉. 我希望它能够响应键盘快捷键,但基本快捷键(参见图片)仅在应用程序具有焦点时才会起作用(在我的情况下,单击菜单时). 所以我需要的是我的应用程序响应系统范围的键盘快捷键. 我试过了: > HotKey但它似乎与Swift 4不兼容,或者我可能无法使用Swift Package
作者:编程之家 时间:2020-08-11
swift – 关闭元组的元组元组
我可以轻松地构建一个元组元组: let tt = (2, (3, 4)) let (a, (b, c)) = tt b // => 3 在声明闭包时我想做同样的事情,例如我以为我可以写: [tt].map { (a, (b, c)) in // Use b } XCode抱怨“未命名的参数必须用空名称写”. 我得到“工作”的唯一方法是: [tt].map { (a, tuple: (b:
作者:编程之家 时间:2020-08-11
Swift 3中最小的工作IteratorProtocol/Sequence
我发现在 Swift 3中使用Sequence / IteratorProtocol找到“工作文档”非常困难.有些教程/文章似乎适用于较旧的Swift. 想象一下名为DLList的玩具双链表类… public class Node { // whatever "thing" you have a group of, this is that "thing" } public
作者:编程之家 时间:2020-08-11
swift 广告轮播图
import UIKit import Kingfisher class BannerView: UIView,UIScrollViewDelegate{ enum ImageType{ case Image //本地图片 case URL //URL } //图片水平放置到scr
作者:编程之家 时间:2020-08-11
[Swift]LeetCode838. 推多米诺 | Push Dominoes
There are N dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right. After each second, each d
作者:编程之家 时间:2020-08-11
swift – 简单的tvOS UIButton无效
我正在尝试实现一个简单的UIButton(tvOS& Swift),但TouchDown事件没有触发. (也试过TouchUpInside). >在模拟器中,我可以直观地看到按下按钮. 我的ViewController.swift代码是: import UIKit class ViewController: UIViewController { override func viewDi
作者:编程之家 时间:2020-08-11
swift – UITableViewAutomaticDimension无法在iOS 8上运行
我正在关注这个 tutorial以制作自我定型细胞. 我将自定义单元格注册到表格视图中,在单元格xib中,我手动给出了每个子视图约束.请参阅source code in GitHub 在一个单元格的内容视图中垂直排列3个标签在iOS 9中运行良好,但在iOS 8中运行良好(均在设备和模拟器中测试). 在iOS 8中,一个单元格没有拟合高度,并且并非每个标签都显示全部文本. iOS 8不合适: iO
作者:编程之家 时间:2020-08-11
swift – 如何在不需要实例化的情况下访问公共常量,如在C#中
不应该需要创建一个类的实例来访问公共常量.我最近开始在 Swift工作,所以我必须在这里遗漏一些东西. 在这个简单的例子中: public class MyConstants{ public let constX=1; } public class Consumer{ func foo(){ var x = MyConstants.constX;// Comp
作者:编程之家 时间:2020-08-11
swift3 – 如何将Date转换为TimeInterval,以便我可以使用if语句
这是我的代码: if let date = messages?.date{ let dateFormatter = DateFormatter() dateFormatter.dateFormat = "h:mm a" //let elapseTimeInSeconds = NSDate.timeIntervalSince(
作者:编程之家 时间:2020-08-11
Swift将NSError转换为String
有没有办法将 swift中NSError类型的错误转换为字符串? 例如,对于这样的事情: do { try response.status(.OK).send(fileName: "html/index.html") } catch { response.status(.FAIL).send(error.CONVERT_TO_STRING) } .send()默认需要一个字符串.
作者:编程之家 时间:2020-08-11
数组 – Swift错误“无法下标类型[Uint8]的值”
大约在最后一小时,我一直在为这个问题感到困惑,而且我的头发已经不多了. 我正在玩AdventOfCode.com第4天(10/10,将再次播放),并希望这个小功能工作. (请不要评论我的代码是多么美丽.这本来就是快速而又脏的,但它现在只是肮脏的.哎呀,我甚至不知道代码是否有机会工作.Allwho …) func countDigestLeadingZeros( theDigest:[UInt8]
作者:编程之家 时间:2020-08-11
数组 – [String]和Array之间的区别
哪个是声明Array和Dictionary的更好方法,我使用了两个: 阵列<字符串> [串] 对我来说[String]在编码方面非常快,但实际上两者在编译器和性能方面有何不同,我们应该遵循哪一个? 来自 Swift上的iOS开发者库… The type of a Swift array is written in full as Array< Element >, where Element is
作者:编程之家 时间:2020-08-11
swift – 是否有joinWithSeparator用于属性字符串
可以使用joinWithSeparator方法使用特定分隔符将字符串数组连接在一起. let st = [ "apple", "pie", "potato" ] st.joinWithSeparator(", ") 结果我们将有“苹果,馅饼,土豆”. 如果我在数组中归因于字符串怎么办?有没有简单的方法将它们组合成一个大的属性字符串? 抓住: import Foundation extension
作者:编程之家 时间:2020-08-11
Swift Simple XOR加密
我试图在 Swift中做一个简单的xor加密例程.我知道这不是一个特别安全或很好的方法,但我只需要简单.我知道代码是如何在 Javascript中实现的,我只是在将它转换为Swift时遇到了麻烦. 使用Javascript: function xor_str() { var to_enc = "string to encrypt"; var xor_key=28 var the_re
作者:编程之家 时间:2020-08-11
斯威夫特 – 从一个单元格中的按钮发出嘘声
我有一个附加到TableViewCell类的自定义单元格,我在该自定义单元格中有一个按钮,我想要乳清我按下它会分割到另一个视图控制器的按钮,但是: performSegueWithIdentifier(identifier: String, sender: AnyObject?) 功能无法识别,如何解决? 编辑: -performSegueWithIdentifier:方法在UIViewContr
作者:编程之家 时间:2020-08-11
从userInfo Dictionary获取字符串
我有来自UILocalNotification的userInfo字典.使用隐式展开时是否有一种简单的方法来获取String值? if let s = userInfo?["ID"] 给我一个AnyObject,我必须强制转换为字符串. if let s = userInfo?["ID"] as String 给我一个关于StringLiteralConvertable的错误 只是不想声明两个变量来
作者:编程之家 时间:2020-08-11
Swift语言概览
? ? ? ? ? ? ? ? ?Swift语言概览 关于 这篇文章简要介绍了苹果于WWDC 2014公布的编程语言——Swift。 前言 在这里我觉得有必要提一下Brec Victor的Inventing on Principle。Swift编程环境的大部分概念都源自于Brec这个演讲。 接下来进入正题。 Swift是什么? Swift是苹果于WWDC 2014公布的编程语言,这里引用The S
作者:编程之家 时间:2020-08-11
[Swift]LeetCode844. 比较含退格的字符串 | Backspace String Compare
Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = "ab#c", T = "ad#c" Output: true Explanation: Both
作者:编程之家 时间:2020-08-11
[Swift]LeetCode843. 猜猜这个单词 | Guess the Word
This problem is an interactive problem new to the LeetCode platform. We are given a word list of unique words, each word is 6 letters long, and one word in this list is chosen as secret. You may call
作者:编程之家 时间:2020-08-11
UIImagePickerController didFinishPickingImage没有在Swift 3中调用
我正在尝试使用imagePickerView从照片库加载图像.我更新了我的plist以获取 Xcode 8的照片库,如下所示. 之后,更新了plist.I可以访问照片库.但是,Picker图像没有加载到我的imageView. 我的代码: 注意: 下面的代码用于Xcode 7而不是Xcode 8? import UIKit class ViewController: UIViewContr
作者:编程之家 时间:2020-08-11
Alamofire 4,Swift 3和构建json身体
{"title":"exampleTitle","hashTags":[{"name":"tag1"},{"name":"tag2"}],"uploadFiles": [{"fileBytes":"seriesOfBytes\n","filename":"upload.txt"}]} 这是我想要发送到后端的我想要的身体. 我正在使用Swift 3.0和Alamofire 4,我有很多问题. 首先,
作者:编程之家 时间:2020-08-11
[Swift]LeetCode862. 和至少为 K 的最短子数组 | Shortest Subarray with Sum at Least K
Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, return -1. Example 1: Input: A = [1], K = 1 Output: 1
作者:编程之家 时间:2020-08-11
[Swift]LeetCode869. 重新排序得到 2 的幂 | Reordered Power of 2
Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is not zero. Return true if and only if we can do this in a way such t
作者:编程之家 时间:2020-08-11
[Swift]LeetCode870. 优势洗牌 | Advantage Shuffle
Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to
作者:编程之家 时间:2020-08-11
[Swift]LeetCode871. 最低加油次数 | Minimum Number of Refueling Stops
A car travels from a starting position to a destination which is target miles east of the starting position. Along the way, there are gas stations. Each station[i] represents a gas station that is st
作者:编程之家 时间:2020-08-11
[Swift]LeetCode873. 最长的斐波那契子序列的长度 | Length of Longest Fibonacci Subsequence
A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the length of th
作者:编程之家 时间:2020-08-11
swift的类型描述符
Metatype Types A concrete or existential metatype in SIL must describe its representation. This can be: @thin, meaning that it requires no storage and thus necessarily represents an exact type (only a
作者:编程之家 时间:2020-08-11
[Swift]LeetCode886. 可能的二分法 | Possible Bipartition
Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size. Each person may dislike some other people, and they should not go into the same group. Fo
作者:编程之家 时间:2020-08-11
上一页
38
39
40
41
42
43
44
45
下一页
小编推荐
热门标签
更多
python
JavaScript
java
HTML
reactjs
C#
Android
CSS
Node.js
sql
r
python-3.x
MysqL
jQuery
c++
pandas
Flutter
angular
IOS
django
linux
swift
typescript
路由器
JSON
路由器设置
无线路由器
h3c
华三
华三路由器设置
华三路由器
电脑软件教程
arrays
docker
软件图文教程
C
vue.js
laravel
spring-boot
react-native