my application is creating different instance of a custom view with a uiwebview as subview in a for loop. but only the delegates of the first instance variable is called. what am i not doing right....?
here's the section of my code which does the instantiation.
if let responseData = JSONData["data"] as? [AnyObject] {
self.storySubviews = []
let dLen = responseData.count-1
for var i=dLen;i>=0;i-- {
var jsonError: NSError? = NSError()
let jsondata = NSJSONSerialization.dataWithJSONObject(responseData[i] as! [String:AnyObject], options: NSJSONWritingOptions(0), error: &jsonError)!
let jsonString = NSString(data: jsondata as NSData, encoding: NSUTF8StringEncoding)!
self.storySubviews.append(Story(data: jsonString,frame: self.container.bounds))
self.storySubviews[dLen-i].backgroundColor = UIColor.redColor()
self.container.addSubview(self.storySubviews[dLen-i])
}
the custom Story view has a uiwebvies as a subview which loads a local html file and calls a javascript fucntion when loading is complete via the "didFinishLoading" delegate.
but now only the first "Story" view calls the delegat.
what can i do to remedy the situation.
thanks