ios - UINotification selecting from handleActionWithIdentifier display specific viewController -
i new ios programming , understand swift language now. app, have set user, local , remote notifications. local notifications have 2 actions, 1 dismiss , other direct user specific viewcontroller.
my viewcontroller hierarchy specific viewcontroller want display tabbarcontroller -> (2nd tab) tableviewcontroller -> (one of many tablecells) viewcontroller
after richard's suggestion, have simplified code above hierarchy. have performed background fetch server in response remote push notification , save content locally before creating local notification inform user. have managed set point guide user correct tab on tabviewcontroller using self.window?.rootviewcontroller.selectedindex = 1
within application:handleactionwithidentifier
in app delegate.
how proceed selecting correct tablecell assuming local notification holds index can used?
edit: after tinkering, managed viewcontroller wanted displayed.
if var tabb = self.window?.rootviewcontroller as? uitabbarcontroller { tabb.selectedindex = 1 var controllers = tabb.childviewcontrollers controller in controllers { if let navcon = controller as? uinavigationcontroller { if let tblvc = navcon.childviewcontrollers.first as? questionnairetableviewcontroller { tblvc.becomefirstresponder() tblvc.moveusertoquestionnaire(questionid) } } } } func moveusertoquestionnaire(questionid : string) { var list = questionnaireobj.getquestionnairelistdata() item in list { var selected = item["questionnaire_id"] as! nsstring string if selected == questionid { selecteduserid = item["study_id"] as! string selectedreplybatchid = item["reply_batch_id"] as! nsnumber selectedquestionnaireid = questionid performseguewithidentifier("selectquestionnaire",sender:self) break } } }
if correct method use, please inform me. thanks! hope helps in process. =)
Comments
Post a Comment