Usernotes in ios

筅森魡賤 提交于 2019-12-22 14:03:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!