0

I am trying to add a button through IB in a custom cell at top right corner of the cell. I am using auto layout to position it correctly but in simulator I don't know why the button wont show up.

But if i create it programmatically then it shows up perfectly.

So my question is how can achieve it using IB and where i am doing it wrong.

I have added four constraints on my button leading and trailing space to superview and fix width and height.

vaibhav
  • 117
  • 2
  • 13

1 Answers1

1

Remove leading space constrain and add fix to top space constrain. I mean there will be total 4 constrains Fixed width, height and fixed trailing, top space to super view and it will work. If it is not working means you have not set your tableView constrains. For tableView fix it from top,bottom,left and right space from super view.

iHulk
  • 4,869
  • 2
  • 30
  • 39
  • yes i have added all four constraints you mentioned but still same behaviour.. about tableview constraints why would i need one.I have used tableView inside UIViewController. so do i need to apply constraints to tableView also. – vaibhav Oct 28 '14 at 13:39
  • @vaibhav yes you need the constrains for tableView also because the view of UIViewController will adjust its size at each phone after it will appear, so its sub views will also adjust their sizes according to the constrains applied on. – iHulk Oct 29 '14 at 05:32