iOS之界面
amberoot_源狼乐
It isn't the burdens today that drive me mad,it is the regrets over yesterday and the fear of tomorrow.
展开
-
iOS swift3.0之CollectionView添加长按手势并识别cell名称
一、在UICollectionViewDataSourced 绘制cell的代理方法中添加长按手势func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collec...原创 2018-07-10 14:34:48 · 1217 阅读 · 0 评论 -
iOS swift3.0 纯代码tableView的使用
简介:1.纯代码创建tableview2.自定义tableViewCell3.把搜索栏添加到表头4.动态添加删除tableViewCell另,我是把表格的数据保存到plist文件中的。保存、修改和删除数据的代码没有贴出来。一、MainViewController文件import UIKitclassMainViewController:UIView...原创 2017-08-29 15:07:51 · 398 阅读 · 0 评论 -
swift3.0 修改UISegmentedControl的字体大小
var segment = UISegmentControl//修改字体大小let font = UIFont.systemFont(ofSize: 20)segment.setTitleTextAttributes([NSFontAttributeName:font], for: .normal)原创 2017-10-27 14:01:28 · 1006 阅读 · 0 评论 -
swift3.0 PickerView的应用
PickerView的使用需实现UIPickerViewDelegate,UIPickerViewDataSource这两个协议classViewController:UIViewController,UIPickerViewDelegate,UIPickerViewDataSource { varpickerData:NSDictionary!...转载 2018-03-15 09:27:30 · 226 阅读 · 0 评论 -
iOS swift3.0之解决(UITableView)表格添加拖动手势冲突造成表格不能滑动问题
一、引用 UIGestureRecognizerDelegateclass ViewController: UIViewController ,UIGestureRecognizerDelegate{二、添加拖动手势到tableviewfunc initGesture() { //初始化手势并指定触发事件 let panGesture = UI...原创 2018-08-07 11:54:10 · 1554 阅读 · 0 评论 -
iOS之绘制空心的圆形-swift4
通过CGPath绘制出空心的圆形原创 2019-04-25 14:16:34 · 2264 阅读 · 0 评论 -
iOS swift之设置页面模态视图风格ModalPresentationStyle
//跳转页面时设置ViewController的显示风格let storyboard = UIStoryboard(name: "Demo", bundle: nil)let controller = storyboard.instantiateInitialViewController()controller?.modalPresentationStyle = .pageShee...原创 2018-07-05 16:53:33 · 2371 阅读 · 0 评论 -
iOS swift3.0之UISlider的简单使用
///添加滑动块 func addSlider(viewController:UIViewController, Frame:CGRect, maxValue:Float, minValue:Float, currentValue:Float, leftColor:UIColor, rightColor:UIColor, backColor:UIColor) { ...原创 2018-08-30 15:38:00 · 439 阅读 · 0 评论 -
iOS swift3.0之自定义按钮button
//// TitleButton.swift// weibo//// Created by mac on 17/8/10.// Copyright 2017年 xww All rights reserved.//import UIKitclass TitleButton: UIButton { override init(frame: CGRect) {...原创 2017-08-10 16:34:23 · 971 阅读 · 0 评论 -
swift3.0之代码裁剪图片(只显示部分图片)
let rect = CGRect(x: 50, y: 50, width: 50, height: 50)let cgImageCorpped = snapRecord.image.cgImage?.cropping(to: rect)let imageCorpped = UIImage(cgImage: cgImageCorpped!)原创 2018-07-05 17:47:35 · 1749 阅读 · 0 评论 -
iOS swift3.0 监听textField和textView的键盘事件
一、声明实现UITextFieldDelegate和UITextViewDelegate委托协议二、从storyboard中获取textField对象(也可以代码创建)三、在viewDidLoad方法中指定textField的委托对象为ViewController四、 实现协议方法...原创 2017-08-16 15:07:39 · 3397 阅读 · 0 评论