title: Custom UITableViewCell with drop-down in Swift
body: <p>I want to implement custom <code>UITableViewCell</code> with XIB. <a href="http://i.stack.imgur.com/bNF3M.jpg" rel="nofollow">Here</a> is the drawing. The button on the right side of the <em>main view</em> shows/hides <em>additional view</em>. I have two questions:</p>
  
  <ol>
  <li><p>How can I hide the <em>additional view</em>? I think that one possibility would be to set height in the frame of additional UIView to zero. Are there any better options? </p></li>
  <li><p>The buttons in <em>additional view</em> (in this case 1-5) should appear dynamically. There are two sets of data: one for the left side (buttons 1-3) and other one for the right side (buttons 4-5). The height for the left buttons is fixed, let's say 70px each. The height of the buttons on the right side should be adjusted so that total height of right side buttons is the same as total height on left side. How can the buttons be added dynamically considering these rules? </p></li>
  </ol>
  
  <p>The buttons will be added during runtime. For example there are two arrays: </p>
  
  <p><code>var leftButtons:[String] = ["button1label", “button2label“, "button3label"]</code></p>
  
  <p><code>var rightButtons:[String] = ["button4label", "button5label"]</code>. </p>
  
  <p>Let's say I add <code>"button6label"</code> to <code>leftButtons</code> later on <em>during runtime</em>. The size for the <code>leftView</code>/<code>rightView</code> as well as the size for the buttons inside these views should be adjusted. Again, height of each button on the left-hand size is fixed.</p>