首页 > 编程语言 > 详细

Swift interface builder问题

时间:2015-07-01 09:52:11      阅读:191      评论:0      收藏:0      [点我收藏+]

 

1. 新建一个view文件,如何用interface builder 将控件连接到code?

2. 如何调整控件间的距离?

2. 手动将button和action加入view

class RatingControl: UIView {

     // MARK: Initialization

    required init(coder aDecoder: NSCoder) {

        super.init(coder: aDecoder)        

        let button = UIButton(frame: CGRect(x: 0,y: 0,width: 44, height: 44))

        button.backgroundColor = UIColor.redColor()

        button.addTarget(self, action: "rattingButtonTapped", forControlEvents: .TouchDown)

        addSubview(button)

    }

 

    

    // MARK: Button actoin

    func ratingButtonTapped(button: UIButton) {

        print("Button pressed!")

    }

}

Swift interface builder问题

原文:http://www.cnblogs.com/iyoubo/p/4612267.html

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