IOS 操作控件

选中 “Show the assistant editor”

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

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


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”)
}

你可能感兴趣的:(IOS 操作控件)