title: Adding UIButton (follow button) in UITableView using swift
body: <p>So here is my Problem.. I've retrieved the user data from <code>_User</code> class in Parse and showing it in the app as follows:</p>
  
  <pre><code>var data:NSMutableArray = NSMutableArray()
  
  
  func loadData() {
  
      data.removeAllObjects()
  
      var userQuery = PFUser.query()
          userQuery?.orderByAscending("createdAt")
          userQuery?.findObjectsInBackgroundWithBlock({ (objects, erroe) -&gt; Void in
  
              if let objects = objects {
  
                  for object in objects {
  
                      if let user = object as? PFUser {
  
                          if user.objectId != PFUser.currentUser()?.objectId {
  
                              self.data.addObject(object)
  
  
  
                          }
  
                          self.tableView.reloadData()
  
  
                      }
  
                  }
              } 
          })
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      loadData()
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  
  }
  
  // MARK: - Table view data source
  
  override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      // #warning Potentially incomplete method implementation.
      // Return the number of sections.
      return 1
  }
  
  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      // #warning Incomplete method implementation.
      // Return the number of rows in the section.
      return data.count
  
  }
  
  
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let myCell = tableView.dequeueReusableCellWithIdentifier("users", forIndexPath: indexPath) as! userListTableViewCell
  
      let userData:PFObject = self.data.objectAtIndex(indexPath.row) as! PFObject
  
      // Usernames and gender..
  
      myCell.fullName.text = userData.objectForKey("fullName") as! String!
      myCell.genderLabel.text = userData.objectForKey("gender") as! String!
  
      // Profile pictures..
  
      let profilePics = userData.objectForKey("profilePicture") as! PFFile
      profilePics.getDataInBackgroundWithBlock { (data, error) -&gt; Void in
  
          if let downloadedImage = UIImage(data: data!) {
  
              myCell.dp.image = downloadedImage
          }
  
      }
      return myCell
  }
  </code></pre>
  
  <p>Now I want to add a follow button to follow a particular user and want to save that data in Parse. So my questions are:  </p>
  
  <ol>
  <li><p>How can I add the follow button effectively which would not mess up things if there are so many users.. I've tried giving them <code>tag</code> like <code>myCell.followButton.tag = indexPath.row</code> but it dint work well. so I want to know about some other way for achieving my goal.</p></li>
  <li><p>What is the best possible way to save the follower list in Parse.. I'm thinking to make a class named <code>Followers</code> having the columns <code>user</code> : the user being followed and <code>follower</code> where we can add the <code>PFUser.currentUser().objectId</code> . Is there anything better than this or this is a nice method to do it?</p></li>
  </ol>
  
  <p>here is the screen shot of my <code>userListTableViewController</code>..</p>
  
  <p><a href="https://i.stack.imgur.com/oOVj4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oOVj4.png" alt="enter image description here"></a></p>
  
  <p>Here you can see the followButton which i've already connected to <code>userListTableViewCell</code>.. Please help me out.. Thanks for your time..</p>