This is from the custom cell:
This is from the Storyboard:
Anyone have any idea how to make these two buttons do the exact same action? Is it possible to make multiple buttons do one action?
I usually keep the backing UIView
s and UIViewController
s very thin in my applications and I create classes that do the actual heavy lifting. This makes for cleaner code and easier reuse.
class Player {
static func play() { // Static makes it easier to call from every class, assuming you only play one song at a time
// play logic goes here
}
}
class MyView: UIView {
@IBAction func play() { // connect in IB in your .xib
Player.play()
}
}
class MyViewController: UIViewController {
@IBAction func play() { // connect in IB in your storyboard
Player.play()
}
}