Sunday, 23 September 2012

variable usage


i have put app nice form laid out ipadand want pass varaible content specific iboutlet in form emailbody of email app send out. built in single view have several segmented controllers, , text boxes each own ibaction can use

code:
  nslog([nsstring stringwithformat:@"%@", [telephonenum text]]);  
to see actual content change in log file.
having difficulty passing information main email build functionality
code:
  mfmailcomposeviewcontroller  
here 1 ibaction segmented controller

code:
  - (ibaction)timeframeanswer:(id)sender {      nslog(@"time frame");      switch (timeframe.selectedsegmentindex) {          case 0:              nslog(@"asap");              outtimeframe = @"asap";              break;          case 1:              nslog(@"1-3 months");              outtimeframe = @"1-3 months";              break;          case 2:              nslog(@"3-6 months");              outtimeframe = @"3-6 months";              break;          case 3:              nslog(@"6+ months");              outtimeframe = @"6+ months";              break;      }  }   
and textbox ibaction

code:
  - (ibaction)emailanswer:(id)sender {      nslog(@"email address");      nslog([nsstring stringwithformat:@"%@", [emailaddress text]]);      outemailaddress = emailaddress.text;            [emailaddress resignfirstresponder];  }  
i have been trying follow along in several tutorials on how done @ brick wall right now
mfmailcomposeviewcontroller has variable in call emailbody , need load each 1 of these responses variable can once know syntax different variable contents.

created in .h file have created many variables similar this
code:
  @property (weak, nonatomic) iboutlet uitextfield *outtimeframe;  @property (weak, nonatomic) iboutlet uitextfield *outemailaddress;  
and corresponding @synthesize in .m file in hopes correct process

code:
  @synthesize outtimeframe;  @synthesize outemailaddress;  
and release them in didunload method

in mfmailcomposeviewcontroller method building emailbody this

code:
  nsstring *emailbody = [nsstring stringwithformat:@"time frame: %@\nemail: %@",self.outtimeframe, self.outemailaddress];  
i think close in coding shown here missing type of syntax or simple.

1 other strange thing enter text 1 of textboxes has space "mickey mouse" see full string in log file shows in emailbody null if enter "mickey" "mickey" shows in emailbody.

know happens in piece
code:
  - (ibaction)fullnameanswer:(id)sender {      nslog(@"full name");      nslog([nsstring stringwithformat:@"%@", fullname.text]);      outfullname = fullname.text;          [fullname resignfirstresponder];  }  
i see warnings throughout ibaction pieces of code
"incompaitible pointer types assigning uitextfield * weak nsstring *"

1 above fullnameanswer clean of warnings

please give me detailed assistance if possible.
jeff
 

here:
code:
 outemailaddress = emailaddress.text;
definition of textfield
code:
@property (weak, nonatomic) iboutlet uitextfield *outemailaddress;
error message
code:
"incompaitible pointer types assigning uitextfield * weak nsstring *"
you treating textfield string , error message trying tell you. should

code:
 [outemailaddress settext:emailaddress.text];
a recommendation wrt naming: if textfield name textfield, if it's string name string. way reducing confusion kind of object hide behind name.

- olaf
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment