数据解析 banner

pod 'Alamofire'
pod 'SQAutoScrollView'
pod 'SwiftyJSON'
 //MARK:解析数据,添加轮播图
    fileprivate func loadCycleView() {
        
        //Alamofire解析数据
        let parameters = ["method":"app.resource.getimg","position":"News-Banner"]
        Alamofire.request("http://test.bit.api.meeboo.cc", method: .get, parameters: parameters, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in
            if(response.error == nil){
                print(response.result.value)
                
            }else{
                print("请求失败\(String(describing: response.error))")
                
            }
            
        }
//解析出的图片网址字符串
        let urls = ["http://www.zhanglirong.cn/themes/simplebootx_en-us/Public/assets/images/demo/1.jpg",
                    "http://www.zhanglirong.cn/themes/simplebootx_en-us/Public/assets/images/demo/3.jpg",
                    "http://www.zhanglirong.cn/themes/simplebootx_en-us/Public/assets/images/demo/2.jpg",
                    ]
        
        let cycleView = SQAutoScrollView(frame: CGRect.init(x: 0, y: 105, width: view.bounds.size.width, height: 150), urls: urls, didItemCallBack: { (view, index) in
            print("view--->\(view), index-->\(index)")
        })
        view.addSubview(cycleView)
}

你可能感兴趣的:(数据解析 banner)