Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-27-2010, 11:46 PM   #1 (permalink)
Registered Member
 
mebarron's Avatar
 
Join Date: Apr 2009
Location: Michigan
Posts: 47
mebarron is on a distinguished road
Default Is is possible to resignFirstResponder, and still cut and paste?

Tags, UITextView, resignFirstResponder, Cut and Paste, Keyboard,UIKeyboardWillShowNotification

The app needs a UITextView which supports Cut and Paste and/or Keyboard input.
When the keyboard appears, the UITextView can be reduced in size, so that
the Keyboard does not overlap it. I am able to paste text into the UITextView,
but now I want to have the TextView "full size" so that I can better select text to "cut and paste"
elsewhere. The Keyboard is in the way. My Newbie Question is:
Is is possible to make the KB disappear and stay hidden , i.e. resignFirstResponder, while at the same time maintaining the Cut,Paste etc. Menu and functionality, Select
text etc. in UITextView(full sized)? It seems that touching the view to "extend" text selection causes the Keyboard to reappear. I know I am failing to look at this problem correctly.
Many Thanks, Mark
mebarron is offline   Reply With Quote
Old 04-28-2010, 07:57 AM   #2 (permalink)
Registered Member
 
manicaesar's Avatar
 
Join Date: Feb 2009
Location: Poznań, Poland
Age: 25
Posts: 103
manicaesar is on a distinguished road
Default

Quote:
Originally Posted by mebarron View Post
Tags, UITextView, resignFirstResponder, Cut and Paste, Keyboard,UIKeyboardWillShowNotification

The app needs a UITextView which supports Cut and Paste and/or Keyboard input.
When the keyboard appears, the UITextView can be reduced in size, so that
the Keyboard does not overlap it. I am able to paste text into the UITextView,
but now I want to have the TextView "full size" so that I can better select text to "cut and paste"
elsewhere. The Keyboard is in the way. My Newbie Question is:
Is is possible to make the KB disappear and stay hidden , i.e. resignFirstResponder, while at the same time maintaining the Cut,Paste etc. Menu and functionality, Select
text etc. in UITextView(full sized)? It seems that touching the view to "extend" text selection causes the Keyboard to reappear. I know I am failing to look at this problem correctly.
Many Thanks, Mark
I don't think it is possible, but in your place, I will try using UITextViewDelegate methods (- (BOOL)textViewShouldBeginEditing: (UITextView *)textView and - (BOOL)textViewShouldEndEditing: (UITextView *)textView).

However, if it is possible, how do you want to distinguish whether user wants the keyboard or not? The only thing that comes to my mind is to have a button: 'Show keyboard' or sth - but this may violate the HUG (Human Interface Guidelines) and Apple may reject your app! I have never seen an application that has the funcionality you described...
__________________
Do you like Age Of War? Have you played 'The Wars' and are not fully satisfied? Try Empires At War - we bet you will love it!


------------------
Full Version
------------------
Lite Version
------------------
YouTube Game Trailer
manicaesar is offline   Reply With Quote
Old 04-28-2010, 08:09 AM   #3 (permalink)
Registered Member
 
mebarron's Avatar
 
Join Date: Apr 2009
Location: Michigan
Posts: 47
mebarron is on a distinguished road
Default Thanks maicaesare!

Quote:
Originally Posted by manicaesar View Post
I don't think it is possible, but in your place, I will try using UITextViewDelegate methods (- (BOOL)textViewShouldBeginEditing: (UITextView *)textView and - (BOOL)textViewShouldEndEditing: (UITextView *)textView).

However, if it is possible, how do you want to distinguish whether user wants the keyboard or not? The only thing that comes to my mind is to have a button: 'Show keyboard' or sth - but this may violate the HUG (Human Interface Guidelines) and Apple may reject your app! I have never seen an application that has the funcionality you described...
----
Thanks very much for your reply.
I do currently have a Button, tied to a BOOL, whose title toggles between "Hide KB" and "Enable KB". Thanks for the HUG heads up.
mebarron is offline   Reply With Quote
Old 04-28-2010, 09:55 AM   #4 (permalink)
Registered Member
 
mebarron's Avatar
 
Join Date: Apr 2009
Location: Michigan
Posts: 47
mebarron is on a distinguished road
Default Reply #2 Skipping Button to control KB hiding

Quote:
Originally Posted by mebarron View Post
----
Thanks very much for your reply.
I do currently have a Button, tied to a BOOL, whose title toggles between "Hide KB" and "Enable KB". Thanks for the HUG heads up.
--
I decided the Hide/Enable button is kludgy. I decided to accept
the continuous presence of the KB. The code below needs Orientation
support but I think this is a good start. I hope this helps others trying to
deal with this situation.
Mark

- (void) handleKeyboardWillShowNSNotification *) note{
NSDictionary *info = [note userInfo];
/*UIKeyboardAnimationCurveUserInfoKey = 0;
UIKeyboardAnimationDurationUserInfoKey = 0.4;
UIKeyboardBoundsUserInfoKey = NSRect: {{0, 0}, {480, 162}};
UIKeyboardCenterBeginUserInfoKey = NSPoint: {240, 559};
UIKeyboardCenterEndUserInfoKey = NSPoint: {240, 239};
*/
NSValue *keyBounds = [info objectForKey:UIKeyboardBoundsUserInfoKey];

CGRect bndKey,tvFrame;
[keyBounds getValue:&bndKey];

/* bndKeys:: NSRect: {{0, 0}, {480, 162}} */ // landscape

tvFrame = pasteIDC_TextView.frame;
tvFrame.size.height -= bndKey.size.height;
[[self pasteIDC_TextView] setFrame:tvFrame];
}
mebarron is offline   Reply With Quote
Reply

Bookmarks

Tags
cut and paste, keyboard, resignfirstresponder, uitextview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 326
21 members and 305 guests
Abidullah, baja_yu, cgokey, Domele, Duncan C, Fstuff, gbenna, givensur, guusleijsten, HowEver, iphonedevshani, jbro, JoeRCruso, mdpauley, n00b, newDev, seokwon lee, SLIC, stanny, Steven.C, WheyLabs
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,112
Posts: 402,876
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:37 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0