Saturday, October 5, 2013

uitextview display problems

UITextView * txt = [[UITextView alloc] initWithFrame: CGRectMake (100, 100, 600, 500)];
txt.text = @ "grebggreberbjeorbnevoenbineoribneiornboiernbioernbioernboiernboiernboienroirnboiernbioernboiernbiorenbioneronboernboreinboirenboboirengioerngoeringeornbroienoienbioenboenoeirbnoierbnoiernbeorvernioenboernboerinboirenbiofnborneoeinoenoenoeirnoiernoenoenoe";
txt.textColor = [UIColor redColor];
[Self addSubview: txt];

Have to drag about this control, the content can be displayed. The same code in other test programs can be displayed properly.
Who knows, Thank you!
Reply:
No, because you do not have to instantiate UITextView after adding view.
The [self addSubview: txt]; into [self.view addSubview: txt];
Reply:
How do you drag?
Reply:
Try to re-layout the current view about
 
UITextView * txt = [[UITextView alloc] initWithFrame: CGRectMake (100, 100, 600, 500)];
txt.text = @ "grebggreberbjeorbnevoenbineoribneiornboiernbioernbioernboiernboiernboienroirnboiernbioernboiernbiorenbioneronboernboreinboirenboboirengioerngoeringeornbroienoienbioenboenoeirbnoierbnoiernbeorvernioenboernboerinboirenbiofnborneoeinoenoenoeirnoiernoenoenoe";
txt.textColor = [UIColor redColor];
[Self addSubview: txt];
[Self setNeedLayout] ;/ / re-layout

No comments:

Post a Comment