
swift
iteye_15461
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
swift 文档中没有涉及的方法
参看文档 http://practicalswift.com/2014/06/14/the-swift-standard-library-list-of-built-in-functions/原创 2014-08-14 13:09:04 · 112 阅读 · 0 评论 -
隐藏状态栏
extension UIViewController { func prefersStatusBarHidden() -> Bool { return true } }原创 2014-11-17 18:56:10 · 130 阅读 · 0 评论 -
array 添加任意对象
extension Array { mutating func AppendObj(obj: T) { //... self.append(obj); } }原创 2014-11-17 13:27:47 · 125 阅读 · 0 评论 -
Bad_Instruction
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Com...原创 2014-11-13 14:26:52 · 1351 阅读 · 0 评论 -
扩展Array 判断包含对象以及其索引
import Foundation extension Array { func contains(object:AnyObject!) -> Bool { if(self.isEmpty) { return false } let array: NSArray = self.bridgeToO...原创 2014-11-13 10:29:59 · 131 阅读 · 0 评论 -
id和instancetype类型在swift中的转换
+ (id)buttonWithType:(UIButtonType)buttonType class func buttonWithType(buttonType: UIButtonType) -> AnyObject! 调用var button = UIButton.buttonWithType(UIButtonType.System) as UIButton + (...原创 2014-08-28 10:23:42 · 882 阅读 · 0 评论 -
loadNibNamed的使用
原来-(id)init{ self = [[[NSBundle mainBundle] loadNibNamed:@"ViewBtnWishList" owner:0 options:nil] objectAtIndex:0]; return self; } swift extension UIView { class func loadFromNibNa...原创 2014-08-25 15:33:37 · 703 阅读 · 0 评论 -
UIActionSheet的使用
var myActionSheet:UIActionSheet = UIActionSheet() var title : String? = "Select Source" myActionSheet.title = title myActionSheet.delegate = self myActionSh...原创 2014-08-21 15:18:51 · 110 阅读 · 0 评论 -
关于KVO context argument:
由于swift没有了指针类型 let myContext = UnsafePointer<()>() observee.addObserver(observer, forKeyPath: …, options: nil, context: myContext) override func observeValueForKeyPath(keyPath: String...原创 2014-08-20 11:00:57 · 191 阅读 · 0 评论 -
colorWithRed
backgroundColor=UIColor .colorWithRed(125/255.0, green: 125/255.0, blue: 125/255.0, alpha: 1.0) 改为 backgroundColor = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) 或者 import Foundatio...原创 2014-08-19 14:31:29 · 287 阅读 · 0 评论 -
isKindOfClass
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { super.touchesBegan(touches, withEvent: event) let touch : UITouch = touches.anyObject() as UITouch if touch.v...原创 2014-08-18 13:52:38 · 240 阅读 · 0 评论 -
多参数函数
func sumOf(numbers: Int...) -> Int { var sum = 0 for number in numbers { sum += number } return sum } sumOf() // returns 0 sumOf(1,2) // retu...原创 2014-08-18 11:04:46 · 183 阅读 · 0 评论 -
swift中三种Singleton
全局变量 private let _SingletonSharedInstance = Singleton() class Singleton { class var sharedInstance : Singleton { return _SingletonSharedInstance } } 嵌套 class Singleton { ...原创 2014-08-16 11:25:14 · 152 阅读 · 0 评论 -
UIKeyboard 边框大小
let frame = (info[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()原创 2014-11-27 18:36:56 · 141 阅读 · 0 评论