objective c - UITextView member variable is always nil in my UIViewController -


in nib, have uitextview component.

in uiviewcontroller have uitextview member field , have used ib make sure 2 connected (at least think did dragging "files owner" , dropping on uitextview in ib , selecting member variable).

now, when update text via settext:, uitextview still remains blank.

when break code, member variable (called textview) nil.

so guessing have not used ib correctly. how can make sure variable connected uitextview graphic element?

here code

// interface looks  #import <uikit/uikit.h>  @interface detailscontroller : uiviewcontroller  {     uitextview *textview; }  @property (nonatomic, retain) iboutlet uitextview *textview;   @end;   // , implementation  #import "detailscontroller.h"  @implementation detailscontroller  @synthesize textview;  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self)      {         // custom initialization     }     return self; }  - (void)dealloc {     [super dealloc]; }  - (void)didreceivememorywarning {     // releases view if doesn't have superview.     [super didreceivememorywarning];      // release cached data, images, etc aren't in use. }  #pragma mark - view lifecycle  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view nib. }  - (void)viewdidunload {     [super viewdidunload];     // release retained subviews of main view.     // e.g. self.myoutlet = nil; }  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes supported orientations     return (interfaceorientation == uiinterfaceorientationportrait); }  // used pressed "done" button - (ibaction)done {     [self dismissmodalviewcontrolleranimated:yes]; }  - (void)setdetails: (nsstring *)detail withquote:(nsstring *)quote {     nslog(@"%@", textview);     [textview settext:detail]; }  @end 

save nib file after connecting outlet, build project , run, should work if it's connected


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -