IOS UITextView 自动选中一段文本

来源:互联网 发布:java电子书阅读器 编辑:程序博客网 时间:2024/06/10 07:26

UITextView *textView = [[UITextView alloc]init];

    textView.text = @"这是一个测试程序adfdafadjl";

    textView.backgroundColor = [UIColor orangeColor];

    textView.frame = CGRectMake(30, 100, 200, 200);

    [self.view addSubview:textView];

    

   //要成为第一响应者,否则无效

    [textView becomeFirstResponder];

    textView.selectedRange = NSMakeRange(0, 6);


0 0
原创粉丝点击