Search Results

Search found 213 results on 9 pages for 'uitextview'.

Page 5/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • keyboard hiding my textview

    - by Risma
    hi guys i have a simple app, it consist of 2 textview, 1 uiview as a coretext subclass, and then 1 scrollview. the others part is subviews from scrollview. I use this scrollview because i need to scroll the textviews and uiview at the same time. I already scroll all of them together, but the problem is, the keyboard hiding some lines in the textview. I have to change the frame of scrollview when keyboard appear, but it still not help. This is my code : UIScrollView *scrollView; UIView *viewTextView; UITextView *lineNumberTextView; UITextView *codeTextView; -(void) viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil]; self.scrollView.frame = CGRectMake(0, 88, self.codeTextView.frame.size.width, self.codeTextView.frame.size.height); scrollView.contentSize = CGSizeMake(self.view.frame.size.width, viewTextView.frame.size.height); [scrollView addSubview:viewTextView]; CGAffineTransform translationCoreText = CGAffineTransformMakeTranslation(60, 7); [viewTextView setTransform:translationCoreText]; [scrollView addSubview:lineNumberTextView]; [self.scrollView setScrollEnabled:YES]; [self.codeTextView setScrollEnabled:NO]; } -(void)keyboardWillAppear:(NSNotification *)notification { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]]; CGRect keyboardEndingUncorrectedFrame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey ] CGRectValue]; CGRect keyboardEndingFrame = [self.view convertRect:keyboardEndingUncorrectedFrame fromView:nil]; self.scrollView.frame = CGRectMake(0, 88, self.codeTextView.frame.size.width, self.codeTextView.frame.size.height - keyboardEndingFrame.size.height); [UIView commitAnimations]; } -(void)keyboardWillDisappear:(NSNotification *) notification { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]]; CGRect keyboardEndingUncorrectedFrame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGRect keyboardEndingFrame = [self.view convertRect:keyboardEndingUncorrectedFrame fromView:nil]; self.scrollView.frame = CGRectMake(0, 88, self.codeTextView.frame.size.width, self.codeTextView.frame.size.height + keyboardEndingFrame.size.height); [UIView commitAnimations]; } can somebody help me please?

    Read the article

  • Dynamic title like in the Notes app

    - by Fran
    Hi, when the user enters text in a uitextview I would that the title of the navigation bar changed dynamically like it happens in the Notes app. How can I achieve this? I think a label is used, don't I? Thanks Fran EDIT: I know how change the title of a navigation bar, but how do this in a such way that the textview is tied to the title, so while user enters the first line of text in the same moment the title changes (letter by letter)?

    Read the article

  • Is it possible to make the iPhone keyboard invisible / remove it without resigning first responder?

    - by Alex Gosselin
    I am looking for a way to show my own input view (a UITableView) to enter certain keywords in a UITextView faster than typing them, and also be able to type into this text view the normal way. My solution has a button that causes the keyboard to disappear, revealing the table view underneath it. Problem is I can't figure out how to make the keyboard go away without resigning first responder, and losing the cursor. Has anyone accomplished this before? Thanks for any help.

    Read the article

  • Limit number of charchters in uitextview !

    - by hib
    Hello All , I am giving a text view to tweet some string . I am applying the following method to restrict the number of characters to 140 in length. - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if([text isEqualToString:@"\b"]){ DLog(@"Ohoooo"); return YES; }else if([[textView text] length] > 140){ return NO; } return YES; } The code is working nicely except the first condition that backspace is not working. suppose that I have reached the limit of 140 characters so that the method will give me false and the user can not insert more characters but after that when I try to delete some characters the text view behave as it is disabled . So the question how do delete characters from textview.text or re-enable the text view .

    Read the article

  • Disable text selection UITextView

    - by marcio
    Hello, i want to disable text selection on a UITextView. Until now what i've already done is: - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { [UIMenuController sharedMenuController].menuVisible = NO; if (action == @selector(paste:)) return NO; if (action == @selector(select:)) return NO; if (action == @selector(selectAll:)) return NO; return NO; } In this away i set UIMenuController to hidden and i put a stop to text copy but the text selection is still visible. Google results (also stackoverflow) take me to no solution. Has someone already faced the same problem? Any ideas? Thanks in advance, marcio

    Read the article

  • UITextInput setMarkedText:selectedRange not working? (Can't be!)

    - by nacho4d
    I want to set the marked text programmatically and since iOS5 UITextView and UITextField conform to UITextInput this should be possible but for some reason I always get the markedText to be nil. :( What am I missing here? This is what I've tried without success: (While the textview is firstResponder) 1.- When the text view contains no text: text: "", selectedRange : {0,0}, markedText: nil. [_textView setMarkedText:@"?" selectedRange:NSMakeRange(0, 1)]; Result: text : "", selectedRange: {0,0}, markedText: nil. (Nothing changed) 2.- When the text view contains text + some marked text: text : "AAA", selectedRange = {0,3}, marked text at the end : "??" then I do: [_textView setMarkedText:@"?" selectedRangeNSMakeRange(0,3)]; Result : text :"AAA", selectedRange: {0,3}, markedText: nil; (the marked text became nil) In both cases is like setMarkedText:selectedRange: would be setting the current marked text (if some) to nil. Any help would be highly appreciated :)

    Read the article

  • UIMenuController Custom Items

    - by Joshua
    I have created a UIMenuController and have set it a custom menu item like so: UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:@"Do This" action:@selector(item1)]; [menuController setMenuItems:[NSArray arrayWithObject:item1]]; But I wanted that object to be the only one to appear so I added this code: - (BOOL)canPerformAction: (SEL)action withSender: (id)sender { BOOL answer = NO; if (action == @selector(item1)) answer = YES; return answer; } The problem is it still shows other## Heading ## items, such as "Select", "Select All" and "Paste". This may have something to do with this being displayed in a UITextView. But how do I stop if from displaying all other items?

    Read the article

  • Text editing best practices (with tags, etc.)

    - by Ron
    Hi there, I want to create a text field with some text, that is styled with tags. Think of MS Word, some ext is bold, some is a headline, etc. The tags that style the text are not visible to the user, he just sees the text in bold. How do I preserve these tags? I mean when I backspace over the closing bold-tag, for example, how do I preserve that and prevent that the rest of the text is now bold until the end? I guess this is a pretty basic question for experiences programmers. Are there any algorithms or best practices? This problem surely has been solved before, any pointers? (If this is of any concern, I develop for the iPhone OS and the text field will be a UITextView, but my question is more general I guess.) Thanks in advance!

    Read the article

  • UITextView or UIWebView with normal words looking like links

    - by diwup
    Hey guys, I was looking at the Twitter for iPhone app and was puzzled. First of all, there are normal words looking like links inside. Second, when I touch those link-like words, the text view (or maybe web view) jumps to the corresponding part below (yes, it doesn't open Safari, it just jumps to the text within that text/web view) Now I want to implement the same effects. I should base my implementation on what? UITextView or UIWebView? How to make normal words look like links? How to make those smooth jumps within such a text/web views? Thanks in advance.

    Read the article

  • How to draw multiple line text to uiimageview iphone?

    - by Hu?nh Phong
    I have UITextView for text, after user press DONE, I convert text to UIImageView and show it. It works with one line of text very good, and Screenshot 1 . But if user types two lines, or more: the result is still one line??? Screenshot 2 I want to display two or more lines in UIimageView Can anybody help me! Thank you very much! Here is my code: -(UIImage *)convertTextToImage : (ObjectText *) objT; { UIGraphicsBeginImageContext(CGSizeMake(([objT.content sizeWithFont:objT.font].width+10), ([objT.content sizeWithFont:objT.font].height+10))); [[objT getcolor] set]; [objT.content drawAtPoint:CGPointMake(5, 5) withFont:objT.font]; UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return result; }

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    Edit Reposting... I accidentally marked my previous question as "commuity wiki" and didn't realize that answers to wiki posts don't generate reputation. I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the UIAlertView the cut/copy/paste popup menu will show in UITextField that's been added to the UIAlertView. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again next time I show the UIAlertView (new instance) unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: - (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the alert view the cut/copy/paste popup menu will show in the text fields that's been added to the alert view. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again when I show the alert view unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • Keyboard not dismissed

    - by sgosha
    I am developing a messaging application that have SMS.app-like UI. Conversation screen has text input field at the bottom which is moved up with keyboard. Tapping on conversation area dismisses keyboard by calling resignFirstResponder method on UITextView that we use. This usually works fine, but users report a weird bug which I can't reproduce and fix. People say that sometimes onscreen keyboard doesn't go away when they tap on conversation area, though text input field loses input focus. Once the view enters that abnormal state users are able to type with keyboard, but text that is being entered is not visible anywhere. This bug happens in one of conversation views and since then no one text input field in other views doesn't work as expected. The only way to stop this weird behavior is killing application from multitasking bar. Even more weird thing is that keyboard stays visible while navigating between view controllers in UINavigationController. I noticed two things: - if tap on ' Anyone else experiencing same problems. Any ideas on what may cause this bug?

    Read the article

  • How to show button ‘Done’ on number pad on iPhone OS 4?

    - by Will Harris
    I'd like to add a Done button to the iPhone number pad keyboard. There's even a handy space at the bottom left for just such a button. Previously, I was using a similar trick to those described in Question 584538 and Luzian Scherrer's excellent blog post, but that stopped working in iOS 4. I can do it by creating a custom inputView, but I'd prefer to extend Apple's keyboard instead of writing my own. Is there a new way to add a view to the standard keyboard? Has someone published an OSS inputView for this? Is there another way?

    Read the article

  • iPhone SDK: TextView, Keyboard in Landscape mode

    - by Arnold
    Hello. How do I make sure that the textview is shown and the keyboard is not obscuring the textview, while in landscape. Using UICatalog I created a TextViewController which works. In it there are two methods for calling the keyboard and making sure that textView is positioned above the keyboard. his just works great in Portrait mode. I got the Landscape mode working, but on the textView is still being put to the top of the iPhone to compensate for the keyboard in portrait mode. I changed the methods for showing the keyboards. Below is the code for this methods: (I will just let see the code for show, since the hide code will be the reverse.. - (void)keyboardWillShow:(NSNotification *)aNotification { UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationPortrait) { // the keyboard is showing so resize the table's height CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.height -= keyboardRect.size.height; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } else if (orientation == UIInterfaceOrientationLandscapeLeft) { NSLog(@"Left"); // Verijderen later CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.width -= keyboardRect.size.height; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } else if (orientation == UIInterfaceOrientationLandscapeRight){ NSLog(@"Right"); // verwijderen later. CGRect keyboardRect = [[[aNotification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; NSTimeInterval animationDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect frame = self.view.frame; frame.size.width -= keyboardRect.size.width; [UIView beginAnimations:@"ResizeForKeyboard" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; } } I know that I have to change the line frame.size.height -= keyboardRect.size.height but I do not seem to get it working. I tried frame.size.width -= keyboardRect.size.height that did not work. Losing the keyboardRect and frame all together work, however off course the keyboard obscures the textview........

    Read the article

  • UITextField in UITableView to becomeFirstResponder.

    - by f0rz
    Hi ! I have a problem which I dont have a clue how to work around. Maybe anyone of you could help me to the correct directions... Simple I have a UITableView with each cell containing a UITextField. When I´m editing a cell (UITextField) and hit Return Key, a new row is inserted under the current cell. After that I reloadData on the TableView, the new row is showed. Everything is OK here. Now to my problem, I want to [UITextField becomeFirstResponder] on the newest added row. But I could not find anyway to accomplish this. I could post code but didn't find that necessary. Cheers.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >