Author Topic: Runtime dynamic scrollview  (Read 7513 times)

vipo

  • Guest
Runtime dynamic scrollview
« on: April 04, 2014, 04:57:16 PM »
solved
« Last Edit: December 05, 2022, 02:50:10 PM by someone »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #1 on: April 04, 2014, 10:42:24 PM »
Scroll views have an origin point. If set, the content will originate there. So set it to top left and your content will be top-left aligned. You will need to call UIScrollView's ResetPosition() function after changing the content.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #2 on: April 04, 2014, 10:54:45 PM »
Right, so choose Center origin point. :P

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #3 on: April 05, 2014, 11:41:35 AM »
Yes, you need to update.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #4 on: April 05, 2014, 12:00:50 PM »
Yes. Update. There is an example of an infinite scroll view. :P

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #5 on: April 06, 2014, 02:35:28 AM »
UIWrapContent already does what grid used to do. Grid repositions children. So does Wrap Content.

Remove the UIGrid.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #6 on: April 06, 2014, 01:37:52 PM »
Not sure what you need explained to be honest. Add content as children of the object that has the wrap script, and it makes wrapping work on its own.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #7 on: April 07, 2014, 11:19:54 PM »
If you need multiple rows, then organize your content like this:

UIWrapContent
- Row 1 (UIGrid)
-- Item 1
-- Item 2
-- Item 3
- Row 2 (UIGrid)
-- Item 4
-- Item 5
-- Item 6

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Runtime dynamic scrollview
« Reply #8 on: April 09, 2014, 03:27:49 AM »
If you are adding content dynamically you need to let UIWrapContent know by calling its WrapContent() function.