ios - Disable a Navigation Bar Button upon Application Launch -


i have application requires select client work when application launched. initiating segue app delegate modal view allows user make selection. view has left bar button says "cancel" , dismissed view. want disabled when user first selects client, enabled subsequent times user opens client select pane.

i have iboutlet in select client view called cancelbutton.

in prepareforsegue method in view controller launching segue, have

if ([segue.identifier isequaltostring:@"selectclient"]) {  if (firstsegue) {     selectclientviewcontroller *select = (selectclientviewcontroller *)segue.destinationviewcontroller;     select.cancelbutton.enabled = no;  }  firstsegue = no; } 

however, button remains enabled on first launch. appreciated.

when prepareforsegue called view hasn't been loaded. if don't make during method view won't loaded till later. if view hasn't been loaded outlets aren't available (they haven't been loaded yet either). so, problem button trying disable doesn't exist yet.

set flag on destination controller disables button in viewdidload or ensure view loaded before try set view properties.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -