tags:

views:

28

answers:

1

Hi My question is that,

11>I have loaded 10 UITextfileds through code 2>when i click on UITextfield,requirement is that ,it should hide all the textfields below it.and keyboard moves up 3>when 2> happens at that time,user either clicks on return button or not It should be work for all 10 textfilds in both case back and forth 4>when 2> happens either user switch from portrait to landscape mode or portrait to Landscape mode without or with pressing return button

in all thess four cases ,keyboard should hide all the UItextfield below textfield which is clicked

+1  A: 

Have you read the part of the documentation of UITextField under "Managing the Keyboard" and "Keyboard Notifications"? If not, read that.

If so, consider using the notification (have your controller register for it):

"UIKeyboardWillShowNotification"

Once registered, use the method called by this notification to hide and move the desired text fields. Of course, you have to hide the keyboard so you can work with the:

"UIKeyboardWillHideNotification" "UIKeyboardDidHideNotification"

Notifications to rearrange things afterwards.

Steven Noyes
what if user rotates the view What should i do in case of autorotation??
My code is working in case of click of return button and it is like this-(void)textFieldDidBeginEditing:(UITextField *)sender{ kOFFSET_FOR_KEYBOARD = 135; // CGRect viewFrame = [ScrollViewObj frame]; viewFrame.size.height -= kOFFSET_FOR_KEYBOARD; ScrollViewObj.frame = viewFrame; keyboardShown = YES; }- (void)textFieldDidEndEditing:(UITextField *)textField{ NSLog(@"end editing"); CGRect viewFrame = [self.view frame]; viewFrame.size.height += kOFFSET_FOR_KEYBOARD; self.view.frame = viewFrame; }
Again, when the user rotates the iPhone OS device, the OS will send out a notification if you have the view set to rotate. So you register for the "UIDeviceOrientationDidChangeNotification" notification and adjust your view positions as needed.
Steven Noyes
I'm not getting your point 100%can u have any example for this?thanksbut i'm stuck help me.
I need proper example to understand.plz help me.
I can't do it without help of u.help me out
One of the best examples I can point to is iTunesU. Great resource. iTunes has a selection called iTunesU when you select the iTunes Store. If you search for iPhone in the iTunes Store, you will find the Winter 2009 and Spring 2010 classes of Stanford University's programming for iPhone class. These are fre downloads and are simply great for learning the background you are missing.
Steven Noyes
can u tell me what should i wite to search it on google?
There is no Google search. Sorry. iTunes ONLY. Since you have a Mac (to do development, you have to already have a Mac), kick up iTunes and go to the store. All of this is free though you will have to register an account with iTunes. You developer account will work.Once in iTMS, search for iPhone and looks at the iTunesU section. There are two class offerings from Stanford University. They really are great.
Steven Noyes