专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Swift

swift创设第一个UIButton 并增加点击事件

发布时间:2011-06-30 07:24:55 文章来源:www.iduyao.cn 采编人员:星星草
swift创建第一个UIButton 并增加点击事件


var button1 = UIButton(frame: CGRectMake(100, 200, 100, 40))
        
        button1 .setTitle("first button", forState:UIControlState.Normal)
        
        button1.addTarget(self, action: "firstSwift:", forControlEvents: UIControlEvents.TouchUpInside)
        
        self.view.addSubview(button1)
        
        button1.backgroundColor=UIColor.yellowColor()
        
        button1.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)

func firstSwift(sender:UIButton)
    {
       println("第一个button的点击事件")
    }

版权声明:本文为博主原创文章,未经博主允许不得转载。

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: