swift总结4

来源:互联网 发布:全民淘宝客能赚钱嘛 编辑:程序博客网 时间:2024/05/20 21:18
1/   控件 可用 var 可用  let 

var tempTableView:UITableView = UITableView (frame:self.view.bounds, style: .Plain)


2/ 

self.zyTableView.separatorStyle = .SingleLine

self.zyTableView.separatorColor = .redColor()


3/  类方法 

    classfunc heros() -> NSArray{

       let bundle: NSBundle =NSBundle .mainBundle()

       let array: NSArray =NSArray (contentsOfFile: NSBundle .mainBundle() .pathForResource("heros.plist", ofType:nil)!)!

       print("打印英雄数组: %@",array)

        let arrayM:NSMutableArray = NSMutableArray ()

       for object in array{

            arrayM .addObject(ZYHero .heroWithDict(objectas! NSDictionary))

        }

       return array

    }

    

   class func heroWithDict(zydictionary:NSDictionary)-> ZYHero {

       return ZYHero (zyDictionary: zydictionary)

    }

    

4/  调用类方法 

var heros:NSArray = ZYHero .heros()



0 0
原创粉丝点击