I want to change/reload my label on activity indicator while i am running on the loop.
But it is not reloading because of “self.netUtil.callWebservice(urlStr) {(data)” i presume.
My code is below
—————————————
self.showActivityIndicator(self.view,message: "Please wait..synchronization is in progress")
//Logic synchronization all Web Service
var urlStr: String = "\(constants.SERVER_URL)"
self.netUtil.callWebservice(urlStr) {(data) -> Void in //I suspect this method to reason why my label is not refreshing
self.beginParsing()
var unitCount = 0
for Prop: Property in self.properties
{
unitCount++
for view in self.view.subviews
{
if view is UILabel
{
view.removeFromSuperview()
}
}
/ refresh label code start here */
var totCount = self.properties.count
var message = "Synchronization \(unitCount)/\(totCount) buildings completed"
dispatch_async(dispatch_get_main_queue(), {
self.lblProcess.text = message
self.lblProcess.setNeedsDisplay()
self.container.addSubview(self.lblProcess)
})
/ refresh label code End here */
//Backup code to be shfted while pushing in web service
self.fileMgr.getSurveyorUnitFiles("", proCode: Prop.proCode as String, isCreateBackup: true)
//back up code ended
self.callUnitsWebservice(Prop.proCode as String) //another web service cal
}
self.hideActivityIndicator()
}
If i am putting the label out of the loop than it is reloading…
What should i do reload label in the loop so that it changes when each loop gets excited?
Thanks for the help in advance