问题
I want to create a user note form in my application,currently am using one textview inside a view its looking bad !! is there any other control suits for this purpose? Main aim is when user click the button a small textview will appear they can add comments there and save it into plist. I want something like this(check the image)
i want that kind of usernotes (its my image) please give me some advices and helps to develop this..
回答1:
Using UIAlertView
with UITextView
can be useful for you.
Implement UIAlertViewDelegate
in .h file.
UITextView *comments;
-(IBAction)btnAddClicked:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Noreply Email" message:@"\n\n\n\n\n" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Send", nil];
comments = [[UITextView alloc] initWithFrame:CGRectMake(15,45, 255, 100)];
[comments setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"mailbody.png"]]];
[comments setFont:[UIFont fontWithName:@"Helvetica" size:15]];
comments.scrollEnabled = YES;
[comments becomeFirstResponder];
[alert addSubview:comments];
[alert show];
[alert release];
}
Here alert will be prompted with small textview you can add comments and then handle text inside delegate method like this.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex==1) //Send button pressed
{
//handle your comment here
NSLog(@"%@",comments.text);
}
}
来源:https://stackoverflow.com/questions/15583805/usernotes-in-ios