خرید بک لینک

Vote count: 0

I'm a newbie in IOS and i'm in small project. In my project i have to load data from Webservice (SOAP) in main controller -> put Data to seacond controller. So, maybe the data load in background thread, the method put data run before the load method. So how i can fix it? this is my code:

class MainRevealController: SWRevealViewController {
var conectData:CoectData = CoectData()
var menuTitle:[String] = []
var menuIcon:[String] = []
override func viewDidLoad() {
    super.viewDidLoad()
    self.conectData.DemoSVNew("", key: "", commandType: "Menu", version: "") { (stringData) in
        print("Hello I'm Loading Data")
        let dataArray = stringData.componentsSeparatedByString("|")
        let decodedData = NSData(base64EncodedString: dataArray[2], options: NSDataBase64DecodingOptions(rawValue: 0))
        let decodedString = NSString(data: decodedData!, encoding: NSUTF8StringEncoding)
        let dataArr = decodedString!.componentsSeparatedByString("<row>")
        for i in 0...dataArr.count-1 {
            let menu = dataArr[i].componentsSeparatedByString("|")
            self.menuTitle.append(menu[3])
            self.menuIcon.append(menu[4])
        }
        print("LoadData :",self.menuIcon.count)
    }
}

override func didReceiveMemoryWaing() {
    super.didReceiveMemoryWaing()
    // Dispose of any resources that can be recreated.
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "sw_rear" {
        let mSegue = segue.destinationViewController as! MenuController
        mSegue.menuTitle = menuTitle
        mSegue.menuIcon = menuIcon
        print("icon :",self.menuIcon.count)
        print("title :",self.menuIcon.count)
    }
}

this is the code show : enter image description here

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 16 فروردين 1395 ساعت: 11:08

صفحه بندی