My code right now uses a for loop to print images placed in the assets folder. I want to do the same thing with text using a label. So in array judo. I would like each entry to be printed in order just like the way it is doing with thee images.
@IBOutlet var lz: UILabel!
var judo = ["a","b","c"]
override func viewDidLoad() {
super.viewDidLoad()
scrol.delegate = self
for image in 0...2 {
lz.text =
let imageTo = UIImage(named: "\(image).png")
let imageView = UIImageView(image: imageTo)
let xCord = view.frame.midX + view.frame.width * CGFloat(image)
contenetWidth += view.frame.width
scrol.addSubview(imageView)
}}
What this code is doing is getting a,b,c to appear on the first 3 page control slides. What I want is on slide 1 to read a on slide 2 to read b etc. Just one letter per page. Thanks again for you help in solving this issue.
Hi @timswift,
You have just one Label and if you want that each page has a label, then like you create the UIImageView, create a UILabel and position it on each page inside the loop.