ios中的用户注释

Posted

技术标签:

【中文标题】ios中的用户注释【英文标题】:Usernotes in ios 【发布时间】:2013-03-23 05:40:49 【问题描述】:

我想在我的应用程序中创建一个用户注释表单,目前在视图中使用一个文本视图,它看起来很糟糕!是否有任何其他控制套装用于此目的?主要目的是当用户单击按钮时会出现一个小文本视图,他们可以在那里添加 cmets 并将其保存到 plist 中。 我想要这样的东西(查看图片)

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

【问题讨论】:

【参考方案1】:

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提示alert,你可以添加cmets,然后像这样在委托方法中处理文本。

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

    if(buttonIndex==1) //Send button pressed
    
        //handle your comment here
        NSLog(@"%@",comments.text);
    

【讨论】:

:根据ios开发我们不能使用AlertView进行用户输入 在哪里读过这个?我们中的许多人使用警报进行输入。甚至developer.apple.com/library/IOs/#documentation/UIKit/Reference/… UIAlertView 它自己也有 UIAlertViewStyleSecureTextInput、UIAlertViewStylePlainTextInput、UIAlertViewStyleLoginAndPasswordInput 输入样式。 他们都说要显示内容 同一个链接...developer.apple.com/library/ios/#documentation/UIKit/Reference/…

以上是关于ios中的用户注释的主要内容,如果未能解决你的问题,请参考以下文章

iOS中的Firebase“管理员用户”?

用户位置的自定义注释视图不移动地图视图

当用户触摸注释时,无法识别的选择器崩溃

Firebase Firestore iOS:如何将图像保存到 Firestore 中的集合中?

python的注释与用户交互 基本数据类型

未读取扩展 Sonata 用户类中的注释