Hey guys,
I have a View-Based application.
There I have a TextView, with some text, and a button that when I press it,
it loads an UIAlertView.
I customized the AlertView to have a text field,
The alert also have 2 buttons, Cancel, and Submit.
I built some code that when I press the button "Submit",
The app will save an array, that contains the TextView,
and the TextField that in the Alert.
The code:
- result.text = TextView.
Somehow, when I'm trying to run it, Its giving me the error (on console):
Hope you will answer me as soon as possible, Tal Shani.
* Sorry if there is any typos.
I have a View-Based application.
There I have a TextView, with some text, and a button that when I press it,
it loads an UIAlertView.
I customized the AlertView to have a text field,
The alert also have 2 buttons, Cancel, and Submit.
I built some code that when I press the button "Submit",
The app will save an array, that contains the TextView,
and the TextField that in the Alert.
The code:
Code:
- (NSString *) savePath
{
NSArray *pathArray =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"save.plist"];
}
- (IBAction) saveMe
{
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"How would you like to call to your story?"
message:@"-" delegate:self
cancelButtonTitle:@"Cancel" otherButtonTitles:@"Save", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 70.0, 260.0, 20.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:myTextField];
myTextField.font = [UIFont fontWithName:@"Arial" size: 15.0];
myTextField.text = nameForSave;
[myAlertView show];
[myTextField release];
[myAlertView release];
}
- (void)alertView:(UIAlertView *)myAlertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
NSLog(@"cancel");
}
else
{
NSLog(@"save");
NSArray *values = [[NSArray alloc] initWithObjects:result.text,nameForSave,nil];
[values writeToFile:[self savePath] atomically:YES];
[values release];
}
}
- result.text = TextView.
Somehow, when I'm trying to run it, Its giving me the error (on console):
And when I'm checking on the .plist file it not showing anything.2010-07-26 12:50:51.704 saveTest[8080:207] save
wait_fences: failed to receive reply: 10004003
Hope you will answer me as soon as possible, Tal Shani.
* Sorry if there is any typos.