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/

相关文章:

iOs模拟器运行缓慢

iphone - 使用点击手势识别器传递参数

ios - "The app "xxx "was not installed on the iPhone "xxx "because it is not compatible with this iPhone"

ios - 你如何删除 UITableView 编辑单元格的阴影?

ios - 当我点击 UIPopoverController 中的一个单元格时推送一个新的 UIViewController

ios - ScrollView 中的手势识别器不起作用

iphone - 调用 UILocalNotification 时触发警报

ios - 奇怪的 EXC_BAD_ACCESS SpriteKit removeSubsprite 崩溃

iphone - Xcode 4.6 失败,退出代码为 255

iOS 应用程序被拒绝,因为它有未记录的 API -- 进一步的步骤