用户注释在ios中

时间:2013-03-23 05:40:49

标签: xcode storyboard uiactionsheet alertview notesview

enter image description here我想在我的应用程序中创建一个用户备注表单,目前我在一个视图中使用一个textview看起来很糟糕!!为此目的还有其他控制套装吗?主要目的是当用户点击按钮时会出现一个小文本视图,他们可以在那里添加评论并将其保存到plist中。 enter image description here我想要这样的东西(查看图片)

我想要那种用户注释(我的形象)请给我一些建议,并帮助我开发这个...

1 个答案:

答案 0 :(得分:0)

UIAlertViewUITextView一起使用可能对您有用。

在.h文件中实施UIAlertViewDelegate

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];
}

此处将通过小textview提示警报,您可以添加注释,然后像这样处理委托方法中的文本。

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(buttonIndex==1) //Send button pressed
    {
        //handle your comment here
        NSLog(@"%@",comments.text);
    }
}
相关问题