简体   繁体   中英

How to change the width of the UITablewViewCell with autolayout?

In one of my tableview i'm using a custom view created with a XIB file. The tableview is correctly resized with autolayout, but the width of the cell is fixed. In particular i saw that the ContentView is fixed to 320 px (the size used on the xib file).

Is there a way to use autolayout to change this value?

Sounds like you haven't set any constraints in your custom cells. The cell itself isn't the problem I guess, usually the container view is. So lets say you created the cell to fit the iPhone and it looks cut off on iPad, it most certainly because the UILabel or UITextView or any other element in the XIB isn't configured to stretch according to its constraints.

There's this beautiful tutorial by ray wenderlich, if you wanna learn more about auto-layout and how constraints secure that your app looks good on any device

If you need further help, just let me know!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM