#ios #objective-c #uiscrollview #uiimageview #uitextview
#iOS #objective-c #uiscrollview #uiimageview #uitextview
Вопрос:
при вводе в UITextView текст не отображается; при вводе текст не отображается.
Как сделать его видимым?
Код приведен ниже. Я намеренно не добавляю код, связанный с UITextView, поскольку установлены только свойства шрифта и выравнивания.
// Setup the background image view.
[self.backgroundImageView setBackgroundColor:[UIColor blackColor]];
[self.view sendSubviewToBack:self.backgroundImageView];
// Set the image view.
CGRect r = CGRectMake(0, 0, self.TextView.bounds.size.width, 455);
ImageView = [[UIImageView alloc] initWithFrame:r];
// Set up the scroll view for the image zooming in/out and scrolling.
imgScrollView = [[UIScrollView alloc] initWithFrame:ImageView.bounds];
[imgScrollView setScrollEnabled:YES];
[imgScrollView setClipsToBounds:YES];
[imgScrollView addSubview:ImageView];
[imgScrollView setBackgroundColor:[UIColor clearColor]];
[imgScrollView setContentSize:ImageView.frame.size];
imgScrollView.maximumZoomScale = 5.0;
imgScrollView.delegate = self;
UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewDoubleTapped:)];
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.numberOfTouchesRequired = 1;
[imgScrollView addGestureRecognizer:doubleTapRecognizer];
[imgScrollView sendSubviewToBack:self.TextView];
[self.view addSubview:imgScrollView];
Обновить
[imgScrollView addSubview:self.TextView];
приведенная выше строка кода решила эту проблему.
Комментарии:
1.
UITextView
В вашем коде нет2. Решаемая. Смотрите обновление.