![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
iOS
20120623
这个作者很懒,什么都没留下…
展开
-
ios中的.snp.makeConstraints
championImage.snp.makeConstraints { (make)in make.left.equalTo(nameLabel.snp.right).offset(25) make.top.equalToSuperview().offset(25) } 加入这段话后报错,空指针 原来是找原创 2018-01-30 11:34:00 · 2116 阅读 · 0 评论 -
swift3 一个tableview,两个section,controller写法
//一个tableview分为两个区域 func numberOfSections(in tableView: UITableView) -> Int { return 2 } //两个区域的行数 func tableView(_ tableView: UITableView, numberOfRowsInSect原创 2018-01-30 17:58:21 · 1559 阅读 · 0 评论 -
swift3 在view中写按钮,在controller中写事件,闭包
闭包在Swift中非常有用。闭包使用具有多样性,比如你可以将闭包赋值给一个变量,你也可以将闭包作为一个函数的参数,你甚至可以将闭包作为一个函数的返回值。它的强大之处可见一斑。 Swift中的闭包类似Objective-C中的Block。其实,如果你想在Swift中实现Objective-C里的Block功能,你可以直接使用闭包来代替。Block和闭包的区别只是语法的不同而已,而且闭包的可读性原创 2018-01-31 18:35:54 · 535 阅读 · 0 评论 -
swift3 UILabel 换行
let infoLabel = UILabel () infoLabel.numberOfLines=0//必须有 infoLabel.textColor = UIColor.gray infoLabel.font = UIFont .systemFont(ofSize: 16) infoLabel.te原创 2018-02-02 13:33:37 · 1778 阅读 · 0 评论 -
swift3 UILabel部分字体变颜色,修改行间距
需要注意:make.left.equalToSuperview().offset(15)make.right.equalToSuperview().offset(-15)//不能少的一句upLeftLabel.snp.makeConstraints { (make) in make.top.equalTo(cancelBtn.snp.bottom).offset(30) ...原创 2018-02-02 14:09:11 · 1710 阅读 · 0 评论 -
Swift - 通过url地址打开web页面
通过 UIApplication.shared.open() 方法,可以使用浏览器打开相应的网页。 1 2 3 4 5 6 7 8 9 10 11 12 let urlString = "http://hangge.com" if let url = URL(string转载 2018-02-05 13:28:57 · 2102 阅读 · 0 评论 -
swift push和pop
push跳转到指定页面 self.navigationController?.pushViewController(FoundNewsViewController(), animated: true) pop返回上一个页面 self.navigationController?.popViewController(animated: true)原创 2018-02-06 15:54:37 · 622 阅读 · 0 评论 -
contentView
contentView.addSubview(subview) self.addSubview(subview) 1、contentView是cell的subView 2、当UITableView.editing = YES时,即设置uitableview编辑状态,那么在自定义的cell中,一定要把cell的subview加载到contentView中; 3原创 2018-02-07 14:10:03 · 348 阅读 · 0 评论