ios - 按 UIbutton 显示 UITextView 频繁

标签 ios iphone

如果您按下 UIbutton 显示 UITextView,将请求代码 Ì 再次按下 UIbutton 再次显示 UITextView :/

enter image description here

最佳答案

.h 文件中只有一个 int 变量,如下所示..

int AddNote;

viewDidLoad: 方法中分配 0 之后,例如..

AddNote = 0;

然后在下面的方法中创建它..

-(IBAction)btnAddTextView:(id)sender
{

    UITextView *txtAddNote=[[UITextView alloc]initWithFrame:CGRectMake(AddNote * 180,20, 180, 44)];
    [txtAddNote setBackgroundColor:[UIColor scrollViewTexturedBackgroundColor]];
    [txtAddNote setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
    txtAddNote.layer.borderWidth = 2.0;
    txtAddNote.layer.borderColor= [UIColor redColor].CGColor;
    AddNote++;

    txtAddNote.tag = AddNote;
    txtAddNote.userInteractionEnabled= YES;
    txtAddNote.delegate = self;
    txtAddNote.textColor = [UIColor whiteColor];
    //    [txtAddNote sizeToFit];
    //    [txtAddNote setClipsToBounds:YES];
    //    [viewTxt setClipsToBounds:YES];
    [self.view addSubview:txtAddNote];

    [txtAddNote release];
}

希望这对您有帮助...

关于ios - 按 UIbutton 显示 UITextView 频繁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13973420/

相关文章:

objective-c - 在 Opengl 中实现非 2 的幂纹理

ios - Xcode 将标签、按钮、导航栏和图像显示为像素化

ios - 使用 Theos 使用 'system' 命令编译错误

ios - CGRectDivide 在 swift 3 中被弃用

iphone - 表格包含这么多Sections,如何单独增加每一行的Label值

iphone - 如何处理 xml 中的所有元素?

ios - 我可以停止在特定时间间隔内快速接收推送通知吗

iphone - 使用从 JSON 数据中提取的值时出现 NSInvalidArgumentException

iphone - MKMapView - 删除注释导致应用程序崩溃

c++ - 当我在我的 xcode 项目中使用 #include <OpenGL/gl.h> 行时,它在哪里寻找 gl.h 文件?