swift 学习 3
2015-09-23 16:27
411 查看
1、UIPopover 使用
在要使用POPover的ViewController 继承 UIPopoverPresentationControllerDelegate
使用方式:
2、UIScrollView 使用
在要使用UIScrollView 的ViewController 继承 UIScrollViewDelegate
在要使用POPover的ViewController 继承 UIPopoverPresentationControllerDelegate
使用方式:
let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let contentViewController :PopContainerViewController = storyboard.instantiateViewControllerWithIdentifier( "popContainerView") as! PopContainerViewController contentViewController.modalPresentationStyle=UIModalPresentationStyle.Popover contentViewController.preferredContentSize = contentViewController.view.bounds.size; let popPC:UIPopoverPresentationController=contentViewController.popoverPresentationController! popPC.permittedArrowDirections=UIPopoverArrowDirection.Left let originX:CGFloat = sender.layer.frame.width let originY:CGFloat = sender.layer.frame.height/2.0//设置箭头指向的位置 popPC.sourceRect.origin=CGPoint(x:originX,y:originY) popPC.delegate=self; popPC.sourceView=sender as? UIView presentViewController(contentViewController, animated: true, completion: nil)
2、UIScrollView 使用
在要使用UIScrollView 的ViewController 继承 UIScrollViewDelegate
scrollView.frame.size=view.frame.size//设置scrollView 的窗口大小 scrollView.backgroundColor=UIColor.greenColor()//用于调试 scrollView.delegate=self scrollView.scrollEnabled=true <span style="white-space:pre"> </span>scrollView.contentSize=size//内容窗口大小
相关文章推荐
- swift -2 元组,函数
- Swift2的更改
- 【面试必备】Swift 面试题及其答案
- Swift多种实现单例写法
- Pods written in Swift can only be integrated as frameworks
- Swift单例写法(推荐)
- swift开发笔记6 - 在表格单元格中添加按钮
- Swift 最佳实践(未完待续)
- swift 基本数据类型--字符串
- Swift中元组及函数
- swift学习笔记(一)NSUserDefaults存储对象的方法
- swift学习笔记(一)NSUserDefaults存储对象的方法
- swift中的函数的使用,嵌套
- Swift - 动态添加删除TableView的单元格(以及内部元件-日期控件)
- swift 风骚的Guard语法
- Swift - 使用TableView的静态单元格进行页面布局
- 黑马程序员——Swift学习笔记:高级类型
- 黑马程序员——Swift学习笔记:高级类型
- 《从零开始学Swift》学习笔记(Day 16)——字典集合
- Swift 2.0学习笔记(Day 16)——字典集合