ios - Add black spaces between images in a image view -


i have scrollview house images download web. adding these images scrollview having trouble adding black space between them. in vertical scroll not horizontal. have been thinking of trying add space can't figure out how it. appreciated. here have far;

private func loadimages() {     myimages = 0;     imagemanager.sharedinstance.getallimagesfromserver({         promotions in         (_,promotion) in promotions {             utility.log(self.dynamictype, msg: promotion.picture, function: "viewdidload")             self.downloadimage(nsurl(string: promotion.picture)!)         }},         onfail: { error_code, detail in utility.log(self.dynamictype, msg: "get iamges fail, error_code: \(error_code), detail: \(detail)",             function: "viewdidload")}) }  func getmyimage(url: nsurl){     getdatafromurl(url) { (data, response, error)  in         dispatch_async(dispatch_get_main_queue()) { () -> void in             guard let data = data error == nil else { return }             print(response?.suggestedfilename ?? "")              let imageview = uiimageview(image: uiimage(data: data));             imageview.frame = cgrect(x: 0,                 y: int(self.myimages * 200), width: int(self.myscrollview.frame.size.width), height: 200)             self.myscrollview.addsubview(imageview)             self.myimages = self.myimages + 1;                self.myscrollview.contentsize = cgsizemake(self.myscrollview.frame.size.width,                 cgfloat(self.myimages * 200));         }     } } 

add space between images. if images 200 points tall, make y position of teach image int(self.myimages * 210).

or better yet, express in terms of image height constant:

let imageheight = 200 let imagewidth = 200 let image = uiimage(data: data) let imageview = uiimageview(image: image); imageview.frame = cgrect(   x: 0,   y: int(self.myimages * imageheight + 10),    width: int(self.myscrollview.frame.size.width),    height: imageheight) 

i don't know if background of scrollview going white or black default. might have set backgroundcolor of scroll view's contentview black.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -