-1

I have a custom UITableViewCell, designed in a .xib file. Everything works fine on iPhone 5, but on iPhone 6, the layout of the cell is different. Since the size of iphone 6 and + is bigger, do i have to create different table view cells for each iphone size or is there any possible way to create the frame of cell with 320 by 170 then resize it for 375 by 170 and 414 by 170?

Hem Poudyal
  • 321
  • 6
  • 16
  • 3
    You should use Autolayout. For years Apple strongly hinted that developers should learn it, and now you know why ;) – Matthias Bauch Dec 02 '14 at 11:04
  • As suggested by other Use Autolayout for UITableViewCell,you can keep that height of cell as static for all devices(if it suits you) and keep the width as the size of superview(this is available in autolayout'). – Abhinandan Sahgal Dec 02 '14 at 11:08
  • I am using auto layout. The problem is still there. – Hem Poudyal Dec 02 '14 at 11:43
  • @HemPoudyal: What problem? You haven't provided any information / images with the actual problem and the expected outcome. You need to use Auto-layout but if it's causing you a problem then please update your question with some specific issue. – Robotic Cat Dec 02 '14 at 12:40
  • @HemPoudyal, if your problem is still there, that means you are not using auto-layout, you have just ticked the checkbox on – but that is not the same thing. :) – holex Dec 02 '14 at 12:43
  • This question appears to be off-topic because it is about it is just about essential lack of knowledge – the issue is not a technical one. – holex Dec 02 '14 at 12:45

2 Answers2

0

You can try to change the Autoresizing settings in your .xib file.

You current setting must be :

enter image description here

Change it to the below :

enter image description here

Rushi
  • 4,553
  • 4
  • 33
  • 46
  • Thanks but I can't see this option in XCode 6.1. I used to use the autoresizing settings before. How can I get it back? – Hem Poudyal Dec 02 '14 at 11:38
  • In First tab of your .xib. which is Identity and Type uncheck the option of Use Autolayout and Use Size Classes. – Rushi Dec 02 '14 at 11:48
  • Did it, but the problem is not solved. While running on iPhone 6 there is the gap on right side :( – Hem Poudyal Dec 02 '14 at 11:56
  • You'll have to change this setting for all your controls in UITableViewCell. Including content view. – Rushi Dec 02 '14 at 11:59
0

If you are not able find Auto Resizing settings in your .xib file, then it will be using Auto Layout setting. you can turn it on/off by the which labeled as "Use Auto Layout" in Finder Inspector, Turn That switch off (remove check mark) and you will get your auto resizing setting back in "Size Inspector". Then select all the size arrow and both resizing arrow for cell's content view.