iphonesubview

How can I add a small UIView(Something like a pop-up window) on existing View?


I want to add a Customized UIView that will take Text input from user. I tried this by creating a new UIViewController which can take text input. But when I Navigation Controller to show this View it occupies entire screen. I don't want entire screen to be covered by new view.


Solution

  • Use an UIAlertView and add text fields to it? Or declare a UIView in your .h file, and link it in the XIB file, then when the user needs to be brought to this view:

    [self.view bringSubviewToFront:textFieldView];
    

    And you are still in the same view, so you can always go back to the original view itself:

    [self.view sendSubviewToBack:textFieldView];