mkc842
mkc842

Reputation: 2381

present view on part of screen; disable surrounding views but keep them visible

When the user presses a button, a text view should pop up in the middle of the screen. Two requirements:

1) Whatever was displayed before should still be visible (except where covered by the text view or keyboard).

2) If the user taps outside the text view or keyboard, nothing should happen.

I thought that if I presented the text view in its own VC, that would address #2, because I think that's how modal presentations work. However, when I do this, even though I set the background of the text view's VC to transparent and tried reducing the frame, all I get is the text view surrounding by black. Nothing is visible behind the presented VC.

EDIT:

It has come to my attention that apparently when you use a tab bar controller, that object does all of the presenting, no matter what VC actually sends the present message to itself. I am using a tab bar controller. Maybe this is part of the issue and forecloses the option of using presentViewController. So I need a different method!

Upvotes: 0

Views: 93

Answers (1)

user1078170
user1078170

Reputation:

You can just add a transparent view the size of the whole screen and put your textView in that. The transparent view won't allow touches to pass through. Then whenever the user is done entering text, you can just remove that transparent view (and the textView along with it) from its superview.

Upvotes: 2

Related Questions