ios - tableView.reloadData() causes crash in Swift -



ios - tableView.reloadData() causes crash in Swift -

i read question asked on stackoverflow making view controller transparent when shown parent view controller can still seen behind. able so:

however when click add together subject table view not add together subject tableview (this view appears behind above view when "+" button tapped):

but if exit main menu , come table view displays list (which want when tap "add subject).

i think due tableview.reloaddata() beingness in viewwillappear function.

with in mind added tableviewclass.tableview.reloaddata "add subject" button action in order reload info button pressed fatal error: found nil while unwrapping optional value , highlights tableviewclass.tableview.reloaddata

i know parent view controller (one table view) not killed 1 time new subject view controller appears in order show behind. why "viewwillappear" never called.

im still little confused why crashing though... here code button:

@ibaction func btnaddtask_click(sender: uibutton){ submngr.addsubjectmona(txtsubject.text, time1: txttime.text, time2: txttime2.text, col: monaview.colorvalue) self.view.endediting(true) var appdel: appdelegate = (uiapplication.sharedapplication().delegate appdelegate) var context: nsmanagedobjectcontext = appdel.managedobjectcontext! var newcell = nsentitydescription.insertnewobjectforentityforname("subjectsentity", inmanagedobjectcontext: context) nsmanagedobject newcell.setvalue(txttime.text, forkey: "starttime") newcell.setvalue(txtsubject.text , forkey: "title") newcell.setvalue(txttime2.text , forkey: "endtime") newcell.setvalue(monaview.colorvalue, forkey: "color") context.save(nil) txtsubject.text = "" txttime.text = "" txttime2.text = "" mondayaclass.tableview.reloaddata() // error here dismissviewcontrolleranimated(true, completion: nil) }

any help appreciated, :)

edit

here code nowadays view controller , create transparent:

@ibaction func addinfo(sender: anyobject) { allow story: uistoryboard = uistoryboard(name: "main", bundle: nil) allow monaadd = story.instantiateviewcontrollerwithidentifier("mondayaadd") mondayaadd monaadd.view.backgroundcolor = uicolor.clearcolor() monaadd.modalpresentationstyle = uimodalpresentationstyle.custom // if line taken out works fine self.presentviewcontroller(monaadd, animated: true, completion: nil) }

fatal error: found nil while unwrapping optional value

this swift's way of saying attempted access nil value. ensure have owning relationship between table view , view controller, , shouldn't happen.

ios uitableview swift ios8 xcode6

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -