Hello. I have a UITextView setup and I am trying to add additional text and my program runs through the appDelegate. Initially the appDelegate does the following:
And the result is successfully displayed in a new view. The setuptextView method is as follows:
So I am putting the timestamp on the beginning of a string and sending it to the setup which works the first time. Then when appDelegate moves into its next function I repeat the same steps:
Inside of setuptextView I have been printing the variable str to see what is coming in and what should be getting set to self.textView.text and it is the string that I want. However, nothing on the view is changed. Anyone out there see something I am doing wrong???
Thanks in advance.
Code:
//initialize variable and allocate memory
ResultController *resultsController = [[ResultController alloc] init];
NSDateFormatter *timeFormatter=[[NSDateFormatter alloc]init];
NSDate *date=[NSDate date];
NSString *timeString;
//set up timestamp and view
[timeFormatter setDateFormat:@"dd-MM HH:mm:ss:SS"];
timeString=[timeFormatter stringFromDate:date];
results=timeString;
results=[[results stringByAppendingString:@" Connecting to server...\n"]retain];
[viewController presentModalViewController:resultsController animated:YES];
[resultsController setuptextView:results];
//release memory
[resultsController release];
[timeFormatter release];
//connect to server
URLRequest *rq = [[[URLRequest alloc]init]autorelease];
[rq data:self requestSelector:@selector(serverRequest:) withURL:URL andMethod:@"initRequest"];
Code:
-(void)setuptextView:(NSString*)str
{
self.textView = [[[UITextView alloc] initWithFrame:self.view.frame] autorelease];
self.textView.textColor = [UIColor blackColor];
self.textView.font = [UIFont fontWithName:@"Courier" size:12];
self.textView.delegate = self;
self.textView.backgroundColor = [UIColor whiteColor];
self.textView.text =str;
self.textView.returnKeyType = UIReturnKeyDefault;
self.textView.keyboardType = UIKeyboardTypeDefault;
self.textView.scrollEnabled = YES;
self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
[self.view addSubview: self.textView];
}
Code:
//initialize variable and allocate memory
ResultController *resultsController = [[ResultController alloc] init];
NSDateFormatter *timeFormatter=[[NSDateFormatter alloc]init];
NSDate *date=[NSDate date];
NSString *timeString;
//set up timestamp and view
[timeFormatter setDateFormat:@"dd-MM HH:mm:ss:SS"];
timeString=[timeFormatter stringFromDate:date];
results=[results stringByAppendingString:timeString];
results=[results stringByAppendingString:@" Getting data file...\n"];
[viewController presentModalViewController:resultsController animated:YES];
NSLog(@"results: %@",results);
[resultsController setuptextView:results];
//release memory
[resultsController release];
[timeFormatter release];
Thanks in advance.