我正在使用这个
library在我的应用程序的横幅.我正在尝试通过解析JSON来获取链接.
图像在幻灯片视图中未显示.如果我按幻灯片视图,之后一切正常.我以为我的完成处理程序有一些问题.
但我不能解决它:)
@IBOutlet weak var slideshow: ImageSlideshow! var transitionDelegate: ZoomAnimatedTransitioningDelegate? var Banner : [AlamofireSource] = [] override func viewDidLoad() { super.viewDidLoad() Banners { (imagesource) in if imagesource != nil { self.bannershow() } } } func Banners(completionHandler: ([AlamofireSource]?) -> ()) -> (){ Alamofire.request(.GET,"http://46.420.116.11/mobileapp/gps/api.PHP?rquest=get_banners") .responseJSON{ response in if let data = response.result.value{ let json = JSON(data) let count = json["image_path"].count for index in 0...count-1 { let image :String = json["image_path"][index].stringValue let source : AlamofireSource = AlamofireSource(urlString: image)! self.Banner.append(source) } completionHandler(self.Banner) } } } func bannershow(){ self.slideshow.backgroundColor = UIColor.whiteColor() self.slideshow.slideshowInterval = 2.0 self.slideshow.contentScaleMode = UIViewContentMode.ScaleToFill self.slideshow.setImageInputs(self.Banner) let recognizer = UITapGestureRecognizer(target: self,action: "click") self.slideshow.addGestureRecognizer(recognizer) } func click() { let ctr = FullScreenSlideshowViewController() ctr.pageSelected = {(page: Int) in self.slideshow.setScrollViewPage(page,animated: false) } ctr.initialPage = slideshow.scrollViewPage ctr.inputs = slideshow.images self.transitionDelegate = ZoomAnimatedTransitioningDelegate(slideshowView: slideshow); ctr.transitioningDelegate = self.transitionDelegate! self.presentViewController(ctr,animated: true,completion: nil) }