This is how I add a scrollView over the whole view --get view size scrollRect = self:view():frame() --make scrollView same size self.scroll = UIScrollView:initWithFrame(scrollRect) --Don't forget to set how big your content is self.scroll:setContentSize(CGSize(320, 550)) --add the scrollView to the view self:view():addSubview(self.scroll)
Then when adding things to the scrollview I use --make button self.newBtn = UIButton:buttonWithType(UIButtonTypeRoundedRect) --set size and position self.newBtn:setFrame(CGRect(100, 100, 60,30)) --add to scroll view self.scroll:addSubview(self.newBtn)
Because if you just add them to the view itself they wont scroll. Also the content size must be bigger than the scrollview in at least the x or the y or it wont scroll.
Comments
--get view size
scrollRect = self:view():frame()
--make scrollView same size
self.scroll = UIScrollView:initWithFrame(scrollRect)
--Don't forget to set how big your content is
self.scroll:setContentSize(CGSize(320, 550))
--add the scrollView to the view
self:view():addSubview(self.scroll)
Then when adding things to the scrollview I use
--make button
self.newBtn = UIButton:buttonWithType(UIButtonTypeRoundedRect)
--set size and position
self.newBtn:setFrame(CGRect(100, 100, 60,30))
--add to scroll view
self.scroll:addSubview(self.newBtn)
Because if you just add them to the view itself they wont scroll.
Also the content size must be bigger than the scrollview in at least the x or the y or it wont scroll.
Regards,
Giles