ios - Modal To Page-Based Layout Stalls WatchKit App -
i've been trying bit of time figure out issue in watchkit app, , hoping may have insight.
initially, built app hierarchical navigation layout, wherein initial view controller shows table populated data, , user can tap cell , "pushed" detail interface controller more contextual information (data being gathered json data , passed ios app via shared app groups).
according developer documentation, it's not possible mix hierarchical , page-based layout, unless modal involved. ideally, i'd user tap cell in initial table, have modal pop-up, , have multiple pages user can flip through have detailed information based on cell chose.
for life of me, cannot figure out how make work. if there no page-based layout involved, app works fine. user taps cell, modal pops up, , proper contextual information display. if add new interface controller , segue nextpage modal, no contextual information passed , commands cease run. if delete nextpage segue, app returns running fine.
here interfacecontroller.swift file;
import watchkit class interfacecontroller: wkinterfacecontroller { var minions = [minion]() @iboutlet weak var miniontable: wkinterfacetable! let defaults = nsuserdefaults(suitename: "group.com.mygroup.data") override func awakewithcontext(context: anyobject?) { super.awakewithcontext(context) //load table reloadtable() //get data passed ios app wkinterfacecontroller.openparentapplication(["request": "refreshdata"], reply: { (replyinfo, error) -> void in if let miniondata = replyinfo["miniondata"] as? nsdata { nskeyedunarchiver.setclass(minion.self, forclassname: "minion") if let minions = nskeyedunarchiver.unarchiveobjectwithdata(miniondata) as? [minion] { self.minions = minions self.reloadtable() } println("datatest: \(self.minions)") } }) } func reloadtable() { if miniontable.numberofrows != minions.count { miniontable.setnumberofrows(minions.count, withrowtype: "miniontablerowcontroller") } (index, minion) in enumerate(minions) { if let row = miniontable.rowcontrolleratindex(index) as? miniontablerowcontroller { row.interfacegroup.setbackgroundcolor(uicolor(red: 39.0/255.0, green: 148.0/255.0, blue: 197.0/255.0, alpha: 1.0)) row.interfacelabel.settext(minion.name) row.interfacedetails.settext("\(age!) years old") } } } override func contextforseguewithidentifier(segueidentifier: string, intable table: wkinterfacetable, rowindex: int) -> anyobject? { if segueidentifier == "minionsegue" { let minion = minions[rowindex] return minion } return nil } override func willactivate() { // method called when watch view controller visible user super.willactivate() nslog("%@ activate", self) } //i have nothing put here override func diddeactivate() { // method called when watch view controller no longer visible nslog("%@ did deactivate", self) super.diddeactivate() } } i can provide more information needed, seems though passing data multiple pages different passing data 1 page. appreciated!
Comments
Post a Comment