摘要: colorWithPatternImage 非常占用内存,而且在swift中去掉了这个方法。sizeView.layer.contents = UIImage(named:"slect_bg")!.CGImage 阅读全文
posted @ 2015-03-10 15:53 ericjuns 阅读(1039) 评论(0) 推荐(0) 编辑
摘要: 在func scrollViewWillBeginDecelerating(scrollView: UIScrollView) {sizeView.setContentOffset(CGPointMake(CGFloat(self.sizeX), 0), animated: true)} 这个函数中... 阅读全文
posted @ 2015-03-10 09:51 ericjuns 阅读(2349) 评论(0) 推荐(0) 编辑
摘要: 首先: 设置使用UIScrollViewDelegate代理协议其次需要初始化全局变量:var picArray = [String]() //图片数量 let scrollview = UIScrollView() let pageControl = UIPageControl()... 阅读全文
posted @ 2015-03-08 18:50 ericjuns 阅读(1381) 评论(1) 推荐(0) 编辑
摘要: 1\ 文字自动换行:label.numberOfLines = 0 阅读全文
posted @ 2015-03-01 17:15 ericjuns 阅读(289) 评论(0) 推荐(0) 编辑
摘要: swift 无法像js那样直接传入参数. 需要借助tag传参:ListBtn.addTarget(self, action: "Detail:", forControlEvents: .TouchUpInside)函数名中增加 ":" 字符咱函数中通过传入这个元素来实现传值:func Detail(... 阅读全文
posted @ 2015-03-01 14:40 ericjuns 阅读(4637) 评论(0) 推荐(0) 编辑
摘要: 主Viewcontroller 需要使用UIViewControllerTransitioningDelegate协议:class ViewController: UIViewController ,UIViewControllerTransitioningDelegate{ var cust... 阅读全文
posted @ 2015-02-28 10:52 ericjuns 阅读(910) 评论(0) 推荐(0) 编辑
摘要: iOS 7 自定义ViewController动画切换自定义动画切换的相关的主要API在深入之前,我们先来看看新SDK中有关这部分内容的相关接口以及它们的关系和典型用法。这几个接口和类的名字都比较相似,但是还是能比较好的描述出各自的职能的,一开始的话可能比较迷惑,但是当自己动手实现一两个例子之后,它... 阅读全文
posted @ 2015-02-20 23:06 ericjuns 阅读(724) 评论(0) 推荐(0) 编辑
摘要: 响应单击事件:blankView.userInteractionEnabled = truelet blankTap = UITapGestureRecognizer(target: self, action: "hiddenDetail")blankView.addGestureRecognize... 阅读全文
posted @ 2015-02-19 20:34 ericjuns 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 一\ 写一个函数:func UIColorFromRGB(rgbValue: UInt) -> UIColor { return UIColor( red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, green: C... 阅读全文
posted @ 2015-02-16 09:28 ericjuns 阅读(1218) 评论(0) 推荐(0) 编辑
摘要: 字符串分隔:var str_componets = "I would prefer a face-to-face talk with my friends"str_componets.componentsSeparatedByCharactersInSet(NSCharacterSet(charac... 阅读全文
posted @ 2015-02-15 10:34 ericjuns 阅读(185) 评论(0) 推荐(0) 编辑