0

So I was trying to create a sample ios application. As I am designing the app UI with the storyboard (and not coding), I find Xcode really hard to understand. what I want to do is I added a scrollView to the view controller. now what I want to do in the scrollView is simple.

I want my scrollView to have buttons (vertically stacked) and it does some action on the basis of the data it is getting from the database. let's suppose it is getting links from the database and on a click of those buttons those links open. now the data may contain 10 links, or 20 links .. basically, we want it to be according to the database.

now if I was designing the UI programmatically it would look something like

ScrollView{
       for loop...{
          button("for example name coming from the  database"
        }
 }

or atleast this is what I know of.

storyboard

so how to do the same with storyboard ? like we first take it's refernce to the uiViewController class.. and then ?

Manu
  • 29
  • 1
  • 9
  • This should be helpful https://stackoverflow.com/a/65023083/12299030, and this https://stackoverflow.com/a/65404848/12299030. Actually search - there are a lot of examples close to your scenario. – Asperi Jun 06 '22 at 19:35

1 Answers1

0

You need to add buttons programmatically if they are created dynamically depending on external non static data. Create new UIViewContoroller class and implement it with connecting storyboard file, the easiest would be to add buttons inside some kind of UIStackView which is inside scrollview imo, or by using UITableView if there are significant number of links to display.

Robert Juz
  • 126
  • 7