How to set size of UIScrollView?

I follow some online examples that I found on how to configure scroll view in the user interface and there was a problem with setting the scroll size. I am trying to set the size height = height of the screen and width = 3x width of screen. Here is the code I'm trying to execute, but CGSizeMake is no longer supported in Swift3. Any suggestions on how to accomplish this without CGSizeMake?

    self.scrollView.contentSize = CGSizeMake(self.view.frame.width * 2, self.view.frame.size.height)

Thank!

+4
source share
1 answer

CGSizeMakedeprecated in Swift 3. Use regular instead CGSize. Your code should look like this:

self.scrollView.contentSize = CGSize(width: self.view.frame.width * 3, height: self.view.frame.height)

main , ( ) CGSize, CGSizeMake .

: CGSizeMake CGSize? ?

, CGSize Swift, "Swifty". CGSizeMake Objective-C

0

Source: https://habr.com/ru/post/1662472/


All Articles