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

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -