ios 7 customizing UITableViewCell's content view

前端 未结 5 619
春和景丽
春和景丽 2021-02-11 00:59

Using storyboard in ios7 the content view is explicitly viewed under the Table View Cell in the story board editor (opposed to previous version

5条回答
  •  独厮守ぢ
    2021-02-11 01:46

    I might be duplicating someone else's answer but I found this workaround which helped bypass this silly XCode bug. Short solution: When you build your custom cell in Storyboard, do NOT drag your UI elements inside the cell or content view.

    Instead, drag them OUTSIDE so that they're child elements of the parent table view!

    It's easiest to do this drag and drop if you use the little hierarchy menu on the left to make sure your elements wind up in the right spot.

    Once the elements are dragged in, just control-click and drag from the custom cell to the UI elements to make your connections. Woo hoo!

    Once your connections are set, then (finally) drag the UI elements back INTO the custom cell's content view and lay them out as you normally would.

    UPDATE: While my method works, look for a comment by thomasdao in an answer below where he just drags the connections directly into the .h file (the little circles in the left margin where you declare your IBOutlets) -- this is actually the easiest solution but unfortunately it's stuck as a comment.

提交回复
热议问题