uitextfield

UITextView get the current line

大城市里の小女人 提交于 2019-12-09 06:07:45
问题 Is there a way (crazy hacks welcome) to get the current line as a string of a UITextView? This would include word wrapping, etc. For example, in this case: The method would return "stack overflow. Isn't it great? I" because that is the current line based on the cursor. It could also return "This is a test I made for" or "think so", based on the position of the cursor. I have tried working with both the UITextView methods and those of UITextInput protocol. EDIT: Here is the code I have

Change of UITextField placeholder color

柔情痞子 提交于 2019-12-09 04:02:40
问题 How to dynamically change placeholder color of the UITextField ? This is always the same system color. No option in xib editor. 回答1: From Docs @property(nonatomic, copy) NSAttributedString *attributedPlaceholder This property is nil by default. If set, the placeholder string is drawn using a 70% grey color and the remaining style information (except the text color) of the attributed string. Assigning a new value to this property also replaces the value of the placeholder property with the

didSelectRowAtIndexPath called after long press

半腔热情 提交于 2019-12-09 03:42:52
问题 I have a uitableview right below a uitextfield that populates similar strings in a uitableview cell . The items get populated. However the didSelectRowAtIndexPath gets called after long press My UITableView (is embedded in UIScrollView) - didSelectRowAtIndexPath: only being called after long press on custom cell My view hierarchy: UIScrollView (outerscroll) Some other views and buttons UITexfield UITableView (tableView) My Code class MyViewController: BaseViewController , UITextFieldDelegate

To enable button if all the textfields are filled in ios

点点圈 提交于 2019-12-09 02:14:32
I have designed a signup form in ios with four UITextField s and a UIButton . I have set the buttons' enabled property to NO by default. Now I want to enable the button only when all the four textfields are filled. Can you please help me out with this as I a new to ios, and stuck with this issue. A better way would be to use the didChange method like the UITextViewDelegate method, but as we know the UITextFieldDelegate does not have a didChange method. You can manually add behaviour. You can use the shouldChangeCharactersInRange: method, but personally I would advise not to override methods

Changing uitextfield return key type while editing

左心房为你撑大大i 提交于 2019-12-08 22:02:49
问题 I have 4 uitextfields that recognize when they are empty or complete. If complete they change their return key type to GO, else is the default one. The problem is the keyboard is not changing the key type even though i use the reloadinputview - (void)viewDidLoad { [super viewDidLoad]; _fieldsArray = @[_nameField, _passwordField, _emailField, _usernameField]; } - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSRange

Keyboard intermittently disappears when editing using IOS 8

时间秒杀一切 提交于 2019-12-08 18:13:44
问题 I had several cases where testers reported that the keyboard would disappear whenever they started typing in some fields in my app. I traced the flow using the simulator and while debugging on a phone and the problem didn't occur, ever. However, when I tried it on an untethered phone it happened fairly consistently. Here's some pertinent code. All of this is to hide the keyboard when a user taps outside a textfield. My UIViews are subclasses of my Touchview class, which receives all touches:

How to make a UIView Scrollable?

為{幸葍}努か 提交于 2019-12-08 18:10:31
Hi there I have a UIView with a bunch of UITextfields. My problem is that my UITextfields are present from the top to the bottom of my screen. So when the keyboard pops up, it covers half the screen and consequently the UITextfields below...What can I do so that all the fields can be edited by simmply scrolling when the keyboard is visible? You need to embed your UIView into a UIScrollView and then change the size of the UIScrollView when the keyboard pops up. Just give the view a new transform that moves it up. Eg. [myView setTransform:CGAffineTransformMakeTranslation(0, -keyboardSize.height)

Warning about assigning to id<UITextFieldDelegate> when I'm conforming to the protocol

允我心安 提交于 2019-12-08 16:27:14
问题 My view controller is conforming to UITextFieldDelegate, yet when I try and set the .delegate field of my text field to self, I get the warning: "Assigning to 'id' from incompatible type 'AddReviewViewController *const __strong'" My header file is this: #import <UIKit/UIKit.h> @interface AddReviewViewController : UIViewController <UITextFieldDelegate> @property (nonatomic) int storeID; @end So as you can see, I have it declared to conform to the protocol. In the .m file, I have this:

UITextField: textRectForBounds: Vs. editingRectForBounds:

三世轮回 提交于 2019-12-08 16:01:24
问题 What's the difference between a UITextField 's rectangle for its text vs. editable text? I just want to move where the text is displayed inside the text field. Should I just override both methods with the same exact implementation? UITextField Class Reference textRectForBounds: Returns the drawing rectangle for the text field’s text. editingRectForBounds: Returns the rectangle in which editable text can be displayed. 回答1: textRectForBounds: lets you set the rectangle for the text when the

UItextfield password

那年仲夏 提交于 2019-12-08 15:48:37
问题 I know that its possible to make UITextfield operate in a password mode by using the following : textfield.secureTextEntry = YES; This changes all characters entered by the user into '*'. However, the last character entered flashes up for about half a second. I understand that this is standard behavior. Is there any way of stopping this and keeping the characters entered completely obscured? To achieve this, Im thinking of subclassing UITextField and then overriding drawTextInRect:rect But I