uitextfield

iOS: Appending an uneditable string to the end of a UITextView

家住魔仙堡 提交于 2019-12-06 14:07:35
I would like to reproduce a screen similar to the Facebook "Update Status" view in iOS. (This text should be editable) Walking (Anything past here should not be editable) - at South Narrabeen Beach The user should be able to enter/edit text to the left of the appended string. The appended string will need to wrap within its parent and be clickable. Does anyone know how this is done? (I have recently seen it in the Viddy app as well). Could it be a growing UITextField with a UIAttributedString split over 2 lines that updates its frame as the text is entered? Update: It looks like what you want

Custom Keyboard Set Cursor Position

邮差的信 提交于 2019-12-06 13:45:06
问题 I have a text field tapping on which a custom keyboard appears containing numbers 0-9 and a backspace button. I'm able to delete text at the end as well as from middle of string. But when i delete text from somewhere middle, the cursor jumps to end position. I want cursor to remain at same position where it was while deleting text. Please reply ASAP and thanks in advance. 回答1: First get the initial position of the cursor (or the end of the selected range): UITextRange *selectedRange =

How to access user input from UIAlertView completion block without delegation?

房东的猫 提交于 2019-12-06 13:31:59
问题 Using iOS6: I would like to retrieve the text entered by a user into a UITextField associated with the UIAlertView. I am aware that I could achieve the desired result with a delegate however I am curious about solving this issue with a callback function as I believe this may be an interesting pattern. I began by examining a common pattern for category extension of the UIAlertView class. Code below. Thanks in advance for any suggestions. import <UIKit/UIKit.h> @interface UIAlertView (Block) -

UITextField underlines from NSAttributedString are only 1 pixel high?

青春壹個敷衍的年華 提交于 2019-12-06 12:37:26
问题 The label (bottom of the picture) and the text field (top) have the same same attributedText. But look at the underlines. The ones in the text field are only one pixel high. This looks terrible. Does anyone know what is causing this or how to prevent it? - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { UITextField* textField = [[UITextField alloc]initWithFrame:CGRectMake(100, 100, 600, 200)]; NSMutableAttributedString* string = [[NSMutableAttributedString

How to set value of UISlider from a UITextField

[亡魂溺海] 提交于 2019-12-06 12:37:18
问题 I am using Xcode 4.3 and I want to be able to edit the value of a UISlider using a UITextField. How can I do this? I have a slider that displays its value in a text field, but can I also set the slider's value from a text field? Thanks for the help!! 回答1: Assuming "textField" is the name of your text field, I would add a target to it in your viewDidLoad method: [textField addTarget:self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged]; And then handle the

giving custom autosuggestion for uitextfield iphone

核能气质少年 提交于 2019-12-06 12:21:36
I have to implement a custom autosuggestion for UITextField> I have an array of words and when I start typing in a textfield then all words similar to the typed text should appear as auto suggestion, like normal auto suggestion in ios but more than one word. And When I tap on one of them it should trigger an event. I know how to done this with a tableview anybody know a method to done this with ios's look and feel? Hashim MH For this purpose I used the project linked below: http://cocoacontrols.com/platforms/ios/controls/autocompletiontableview Tatarasanu Victor A sexy look for a autocomplete:

UITextField becomeFirstResponder crashes the iOS app randomly

馋奶兔 提交于 2019-12-06 12:13:43
I developed an app which had multiple text fields with the glow border for the text field. It has been working fine when I do an internal testing, but I see the Fabric is reporting the crash with the following stacktrace. Am I missing something to trace this issue? Can anybody give some light on this issue? Thread : Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x185de0f48 __exceptionPreprocess 1 libobjc.A.dylib 0x19a92ff80 objc_exception_throw 2 CoreFoundation 0x185de0e90 -[NSException initWithCoder:] 3 Foundation 0x186c85fb4 -[NSISEngine

Expandable UITextField with option for inserting image

做~自己de王妃 提交于 2019-12-06 12:13:01
问题 I want to make the same view as iPhone default message app here is the screen shot what i want to do so can any one help me for suggesting 3rd party control or technique for making this kind of control in my app 回答1: Here is the Source code you wanted for the Growing TextField , although it doesn't contains the image button but you can easily customize it to fullfil your requirement https://github.com/HansPinckaers/GrowingTextView Hope it will help you. 回答2: You can add the image view as a

How can I draw Rounded Rectangles around my textfields and buttons like Foursquare app

我们两清 提交于 2019-12-06 12:10:25
How can I draw a background behind all my buttons and textfields like on the Foursquare iPhone app? See where it says "Share with..." You can achieve rounded corners on any view by changing the cornerRadius property of the view's backing CALayer. To access these properties, you will have to link against the QuartzCore framework. Then you can change the corner radius like this: textFieldBackgroundView.layer.cornerRadius = 10; Just make sure to add <QuartzCore/QuartzCore.h> to your project and #import it. 来源: https://stackoverflow.com/questions/5138996/how-can-i-draw-rounded-rectangles-around-my

How to test a UITextField for being nil?

天涯浪子 提交于 2019-12-06 11:49:50
问题 I am trying to make a part of my app where if the person doesn't change the blank text in my UITextField, then he/she can't go on to the next step. Basically, I want to test the UITextField for nil text. I have used the if (text == @"") method, but if the person clicks on the UITextField but doesn't type, then the if statement doesn't work. For some reason it doesn't think the text == nil or "". Am I implementing the code wrong. Any other options. Please help!!! 回答1: You should be checking