Search code examples
uitableviewswiftios6

Unable to access custom tableviewcell button properties in Swift


Working on my first iOS app. I have created nib and a custom tableview cell. The cell has buttons and labels. I am able to access the labels but for some reason I cannot get the properties of the buttons such as set title, for example. I only have access to the following:

cell.followUserButton(sender: AnyObject)

Why can't I just go

cell.followUserButton.setTitle = "Unfollow" 

I looked online quite a bit. Couldn't find anything. Any help is appreciated. Thanks.


Solution

  • Solved my own problem. I was setting it as only an IBAction. If you want to change the attributes then you also have to make the button an outlet too!

    @IBOutlet weak var followUser: UIButton!

    As you may already know, you can do this within the storyboard. Works perfectly now.