How to limit the content in UITextView in ios

前端 未结 7 2251
迷失自我
迷失自我 2021-02-08 11:56

I want to load long text in TextViews of different Views. The text should be divided to pages when it reaches end of the textviews. And the next textview must start with the con

7条回答
  •  不思量自难忘°
    2021-02-08 12:45

    Use following method :

     NSString *textEntered = [[[tvQuestion.text copy] autorelease] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    
            //Added for 450 character restriction 
            if([textEntered length] > 450) {
                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Message" message:kMoreThan450CharactersForQuestion delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                [alertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
                [alertView release];
            }
    

提交回复
热议问题