-2

How to pop up the Edit Text box when the button is tapped using objective c.Am trying to do but i want some help.Can some body provide some samples for me.I made googling but am not able to find the solution.Please some body help me?

user
  • 86,916
  • 18
  • 197
  • 190
Ratnakar
  • 443
  • 3
  • 11
  • i want to enter some text when the edit text box is poped up – Ratnakar Jun 07 '12 at 06:28
  • What do you mean? What EditText box? What button? You need to post more details and try to be clearer. Your question is not easy to understand as it is right now – BBog Jun 07 '12 at 06:47
  • Hi boss.Thanks for replying.Not edit text box,UITextView,when i click a RoundRect button,UITextView is to be displayed – Ratnakar Jun 07 '12 at 06:53
  • In the sense when i tap a button,UITextView need to be popd up for user to enter some text – Ratnakar Jun 07 '12 at 06:54
  • So you have a button and when you press that button you want an UITextView to be displayed inside an UIPopoverController? – BBog Jun 07 '12 at 06:54
  • yes you understood ma question Bodgan Bucur – Ratnakar Jun 07 '12 at 07:05

1 Answers1

0

Ok, this is rather easy if I understood correctly what you need.

First, you need to make a new UIViewController, called let's say TextViewController

Inside TextViewController you place your UITextView, making it as big as you need, changing the font or whatever you might need/want.

After this all you need to do is to present TextViewController inside an UIPopoverController ( http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html ) The code should look something like this

TextViewController* textViewController = [[TextViewController alloc] init];

UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:textViewController];

aPopover.popoverContentSize = CGSizeMake(320.0,110.0); //sets the size of the popover

[aPopover presentPopoverFromRect:yourButton.frame inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

where textViewController is the view controller with the UITextView and yourButton is the rounded button you tap on.

This tutorial should also be useful: http://www.raywenderlich.com/1056/ipad-for-iphone-developers-101-uipopovercontroller-tutorial

Community
  • 1
  • 1
BBog
  • 3,630
  • 5
  • 33
  • 64