swift - Making UITableViewCell a square based on screen width -


i have table view controller displaying square videos, , want each table view cell square well. possible have each uitableviewcell dynamically resize according width of screen (for example 320x320 iphone5 , 375x375 iphone6)?

in view controller's viewdidload function have:

    framewidth = self.view.frame.size.width     self.videosview.rowheight = uitableviewautomaticdimension     self.videosview.estimatedrowheight = framewidth 

the constraints view displays video inside uitableviewcell are: leading , trailing space superview, top space superview, 1:1 aspect ratio

i still can't cell square though. appreciated!

there reason hard do. cells inside uitableview reused can allocated once. (for performance) resizing view performance wise costly, that's way put 1 number height of cell.

what can have if statement , return accordingly phone version.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -