Post

Replies

Boosts

Views

Activity

Adding border colour to page control applies background colour to page control
I tried adding border - https://stackoverflow.com/questions/35842040/add-border-for-dots-in-uipagecontrol colour to page control and it applies background colour instead. The code below is the method I used to add border colour. The hyperlink above is where I got this solution. This method works no more in iOS 14 said a user. extension UIPageControl {   func customPageControl(dotFillColor:UIColor, dotBorderColor:UIColor, dotBorderWidth:CGFloat) {     for (pageIndex, dotView) in self.subviews.enumerated() {       if self.currentPage == pageIndex {         dotView.backgroundColor = dotFillColor         dotView.layer.cornerRadius = dotView.frame.size.height / 2       }else{         dotView.backgroundColor = .white         dotView.layer.cornerRadius = dotView.frame.size.height / 2         dotView.layer.borderColor = dotBorderColor.cgColor         dotView.layer.borderWidth = dotBorderWidth       }     }   } }
7
0
2.5k
May ’21
nil on unwrapping ScrollView
I'm developing a feature slider by paginating ScrollView. My application crashes when I call the ViewController of the slider. I tried all possible solutions available on the internet such as clean build, reconnecting the scrollView, etc..., I'm looking for a possible fix. Thanks in advance import UIKit class IntroSliderViewController: UIViewController {       @IBOutlet weak var slider: UIScrollView!       let slide1 = ["background":"sliderBackground-1", "mainImage":"sliderMainPic-1", "heading":"....", "content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi aenean suspendisse proin nunc risus sed. Aliquet faucibus sed commodo tellus magna cursus. Eget mauris congue at ornare."]       let slide2 = ["background":"sliderBackground-2", "mainImage":"sliderMainPic-2", "heading":"....", "content":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi aenean suspendisse proin nunc risus sed. Aliquet faucibus sed commodo tellus magna cursus. Eget mauris congue at ornare."]       let slide3 = ["background":"sliderBackground-3", "mainImage":"sliderMainPic-3", "heading":".....", "textContent":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi aenean suspendisse proin nunc risus sed. Aliquet faucibus sed commodo tellus magna cursus. Eget mauris congue at ornare."]       var slides = [ DictionaryString,String ]()       override func viewDidLoad() {     super.viewDidLoad()           slides = [slide1,slide2,slide3]     slider.isPagingEnabled = true     slider.contentSize = CGSize(width: self.view.bounds.width, height: self.view.bounds.height)     slider.showsHorizontalScrollIndicator = false           loadSlides()   }       func loadSlides() {           for (index,content) in slides.enumerated(){               if let slide = Bundle.main.loadNibNamed("sliderContent", owner: self, options: nil)?.first as? SliderContentView {                   slide.backgroundImage.image = UIImage(named: content["background"]!)         slide.mainImage.image = UIImage(named: content["mainImage"]!)         slide.heading.text = content["heading"]         slide.textContent .text = content["textContent"]                   slider.addSubview(slide)         slide.frame.size.width = self.view.bounds.size.width         slide.frame.size.height = self.view.bounds.size.height         slide.frame.origin.x = CGFloat(index) * self.view.bounds.size.width       }             }         }     }
4
0
847
May ’21