uitextview
Getting cursor position in a UITextView on the iPhone?
Like drewh said, you can use UITextView’s selectedRange to return the insertion point. The length of this range is always zero. The example below shows how to it. NSString *contentsToAdd = @”some string”; NSRange cursorPosition = [tf selectedRange]; NSMutableString *tfContent = [[NSMutableString alloc] initWithString:[tf text]]; [tfContent insertString:contentsToAdd atIndex:cursorPosition.location]; [theTextField setText:tfContent]; [tfContent release];
Is there an iPhone equivalent to the NSTokenField control?
Venmo just open sourced their token field. https://github.com/venmo/VENTokenField.git
Border around UITextView
#import <QuartzCore/QuartzCore.h> Import the above framework and include these lines in your class where textview is defined. [[self.textview layer] setBorderColor:[[UIColor grayColor] CGColor]]; [[self.textview layer] setBorderWidth:2.3]; [[self.textview layer] setCornerRadius:15]; Swift solution. self.textview.layer.borderColor = UIColor.gray.cgColor self.textview.layer.borderWidth = 2.3 self.textview.layer.cornerRadius = 15
how to know when text is pasted into UITextView
Here is what i use to detect paste events in UITextView: // Set this class to be the delegate of the UITextView. Now when a user will paste a text in that textview, this delegate will be called. -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { // Here we check if the replacement text is equal to … Read more
How to support dynamic type in labels in iOS 7?
If you use the new UIFont methods then you’re pretty much there – you just need to add the observer to listen for changes. Rather than setting a specific font size, you should use the preferredFontForTextStyle: and related methods when styling your labels (if you’re using Interface Builder you can select a style directly in … Read more