objective c - NSLogging UILabel's text outputs null -
i have custom view controller called timerviewcontroller , subclasses of called firstviewcontroller , fourthviewcontroller.
i declared instance of firstviewcontroller in firstviewcontroller's .h named controller.
in viewdidload method of fourthviewcontroller's .m, have:
controller = [self.storyboard instantiateviewcontrollerwithidentifier:@"maincontroller"]; in storyboard, i've declared view controller id maincontroller , declared custom class of fourthviewcontroller. then, in fourthviewcontroller's .m have:
controller.mainlab.text = [nsmutablestring stringwithformat:@"this string"]; nslog(@"%@", controller.mainlab.text); this, however, outputs (null).
why happen?
mainlab must nil. outlet isn't connected xib.
as aside, using stringwithformat: string isn't format wasteful.
Comments
Post a Comment