Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITextview始终显示垂直滚动条_Ios_Iphone_Objective C_Cocoa Touch_Uitextview - Fatal编程技术网

Ios UITextview始终显示垂直滚动条

Ios UITextview始终显示垂直滚动条,ios,iphone,objective-c,cocoa-touch,uitextview,Ios,Iphone,Objective C,Cocoa Touch,Uitextview,我试图在代码开头显示uitextview上的垂直滚动条 但事实并非如此 UITextView *txtView=[[UITextView alloc]initWithFrame:CGRectMake(10, 80,self.view.frame.size.width-20,self.view.frame.size.height/2)]; [txtView setEditable:NO]; [txtView setSelectable:NO]; [txtView setText:self.

我试图在代码开头显示uitextview上的垂直滚动条 但事实并非如此

UITextView *txtView=[[UITextView alloc]initWithFrame:CGRectMake(10, 80,self.view.frame.size.width-20,self.view.frame.size.height/2)];    
[txtView setEditable:NO];
[txtView setSelectable:NO];
[txtView setText:self.secret];
[txtView setBackgroundColor:[UIColor clearColor]];
[txtView setTextColor:[UIColor whiteColor ]];
[txtView setFont:font];
txtView.showsVerticalScrollIndicator=YES;
[txtView flashScrollIndicators];
[self.view addSubview:txtView];
如果你只是写[textView flashScrollIndicators];在创建textView或加载页面时,它只会闪烁一次。没有任何代码或方法连续/永久显示FlashScroll指示器

要做到这一点,您需要借助时间间隔很小的NSTimer,并用定时器的方法编写textView的闪烁指示灯代码。诸如此类

[NSTimer scheduledTimerWithTimeInterval:0.001f target:self selector:@selector(flashIndicator) userInfo:nil repeats:YES]; // set time interval as per your requirement. 
调用方法

-(void)flashIndicator
{
  //here you need to write code:
  [txtView flashScrollIndicators];
}
欲了解更多信息,请澄清:

UITextView属于UIScrollView类。因此,有一种方法可以调用flashScrollIndicators来提示用户视图是可滚动的。当用户进入包含UIScrollView或其子类的页面时,它只会闪烁几秒钟。您可以将计时器设置为多次调用此方法

如果你只是写[textView flashScrollIndicators];在创建textView或加载页面时,它只会闪烁一次。没有任何代码或方法连续/永久显示FlashScroll指示器

要做到这一点,您需要借助时间间隔很小的NSTimer,并用定时器的方法编写textView的闪烁指示灯代码。诸如此类

[NSTimer scheduledTimerWithTimeInterval:0.001f target:self selector:@selector(flashIndicator) userInfo:nil repeats:YES]; // set time interval as per your requirement. 
调用方法

-(void)flashIndicator
{
  //here you need to write code:
  [txtView flashScrollIndicators];
}
欲了解更多信息,请澄清:

UITextView属于UIScrollView类。因此,有一种方法可以调用flashScrollIndicators来提示用户视图是可滚动的。当用户进入包含UIScrollView或其子类的页面时,它只会闪烁几秒钟。您可以将计时器设置为多次调用此方法


您可以为此使用setContentSize属性。通过将其设置为大于文本视图,您可以使用滚动指示器。

您可以为此使用setContentSize属性。通过将其设置为大于文本视图,您可以使用滚动指示器。

视图中的flashScrollIndicators显示:当用户实际看到屏幕时。视图中的flashScrollIndicators显示:当用户实际看到屏幕时。[txtView setContentSize:CGSizeMakeself.view.frame.size.width,self.view.frame.size.height+100];无法工作[txtView setContentSize:CGSizeMakeself.view.frame.size.width,self.view.frame.size.height+100];不起作用