-1

I am working with a custom view class that is NOT in a UIViewController. Based on the text entered into the text field of my custom view, I want to present a UITableView over the rest of the screen (nevermind frame size concerns).

This behavior is identical to what happens when you start tagging someone in a post on Facebook or Twitter, starting with the @ sign: A table view is presented with a list of users that you can select to tag.

So, from a view (not viewController), how can I present a UITableView on top of the parent view that my custom view is displayed in? Is my only option to do this by adding a UITableView to the UIWindow? If so, how? I've read all the questions related to that, and none of them address my concerns.

jungledev
  • 4,195
  • 1
  • 37
  • 52

1 Answers1

1

Yes, you can do that.

AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; //create object of your AppDelegate

UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)]; //set your desired frame
[delegate.window addSubview:tableView];
tableView.layer.zPosition = 1; //table will appear on top of your screen

I have checked it, its working, so hope it helps

Bhanupriya
  • 1,202
  • 1
  • 9
  • 20