UITtextView в UIScrollView - PullRequest
       4

UITtextView в UIScrollView

0 голосов
/ 11 марта 2012

Создано UITextView в UIScrollView

scrollView = [[UIScrollView alloc]init];

self.textView = [[[UITextView alloc] initWithFrame:CGRectMake(10, 225, 300, 100)]autorelease];

self.textView.textColor = [UIColor brownColor];

self.textView.font = [UIFont fontWithName:@"Georgia-Bold" size:14];

self.textView.textAlignment = UITextAlignmentCenter;

self.textView.backgroundColor = [UIColor colorWithHue:2.0/12 saturation:2.0 brightness:4.0/10 alpha:1.0];

self.textView.editable = NO;

self.textView.textAlignment =  UITextAlignmentCenter;

self.textView.text = @"this is uitext. this is uitext.....";

[scrollView addSubview:textView];

Все, что я могу видеть, это черный экран, почему я не вижу текстовое представление.

Спасибо за помощь.

Ответы [ 3 ]

2 голосов
/ 11 марта 2012

Попробуйте этот код

[self.scrollView addSubview:textView];

Надеюсь, это поможет вам

0 голосов
/ 29 апреля 2013
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[self.view addSubview:scrollView];
self.textView = [[[UITextView alloc] initWithFrame:CGRectMake(10, 225, 300, 100)]autorelease];

self.textView.textColor = [UIColor brownColor];

self.textView.font = [UIFont fontWithName:@"Georgia-Bold" size:14];

self.textView.textAlignment = UITextAlignmentCenter;

self.textView.backgroundColor = [UIColor colorWithHue:2.0/12 saturation:2.0 brightness:4.0/10 alpha:1.0];

self.textView.editable = NO;

self.textView.textAlignment =  UITextAlignmentCenter;

self.textView.text = @"this is uitext. this is uitext.....";

[scrollView addSubview:textView];
0 голосов
/ 29 апреля 2013

Вероятно, решено несколько месяцев назад, но, вероятно, это должно быть сделано (для людей, которые гуглят и находят этот вопрос)

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[self.view addSubview:scrollView];
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...