首页 > 编程语言 > 详细

Swift的下标代码

时间:2015-11-02 21:01:47      阅读:146      评论:0      收藏:0      [点我收藏+]

//下标subscript,可以有多个参数

subscript(index:int)->

{

get{

return images[index]

}

set{

images[index]=newValue

}

}

func getImage(index:Int)->

{

return images[index]

}

let xc=XiangCe()

xc.getImage(0)

xc[0]

xc[0]=100

xc[0]

Swift的下标代码

原文:http://www.cnblogs.com/tyty/p/4931190.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!