IOS 操作控件

选中 “Show the assistant editor”

UIControl的属性和方法:
alignment
content
state
enabled
selected
highlighted
contentVerticalAlignment
contentHorizontalAlignment

addTarget(_target:,action action:selector,forcontrolevents controlEvents:UIControlEvents)


9967595-b3730bfb70726332.png
image.png

self.btn.isEnabled=true
self.btn.isHighlighted=true
self.btn2.contentVerticalAlignment = .top
self.btn2.contentHorizontalAlignment = .center

@IBAction func touchupInsideBtnAction(sender:AnyObject, forEvent event:UIEvent)
{
print(“按下的按钮是 Button”)
btn.sendAction(#selector(ViewController.helloWorld),to:self, forEvent:nil)
}
func helloWorld(){
print(“helloWorld”)
}

猜你喜欢

转载自blog.csdn.net/weixin_33937778/article/details/90866432
今日推荐