UIScrollView not scrolling in Swift

前端 未结 12 1211
Happy的楠姐
Happy的楠姐 2021-02-03 19:03

My UIScrollView won\'t scroll down. I don\'t know why. I already followed Apple documentation regarding to this issue.

@IBOutlet weak var scroller: UIScrollView!         


        
12条回答
  •  南旧
    南旧 (楼主)
    2021-02-03 19:31

    You need to set the frame of your UIScrollView so that it is less than the contentsize. Otherwise, it won't scroll.

    Also, I would recommend that you add scroller.contentSize = CGSizeMake(400, 2300) to your viewDidLoad method.

提交回复
热议问题