uitextfield

How to create a UITextField like MFMailComposer has?

∥☆過路亽.° 提交于 2019-12-03 14:44:54
问题 I want to create a MFMailComposer like UITextField like when we type an email address it converted into blue round button like shape. I do not want to use Three20's MailComposer. I want to create my own.Any idea how to achieve this? or if there is already a UITextField or whatever control is out there please let me know. EDIT: I've checked three20's TTCatalog demo. And It has all the things I want except a few like when I type an email address manually it's not converted into the blue button

UITextField How to check if a delete key is pressed

自作多情 提交于 2019-12-03 14:25:01
I am implementing a search bar from my local database that searches from db as user enters info.The issue is that i concat recent character and the previous ones and then send it for search.How can I REMOVE the character (last one) when back key is pressed.I am using - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string Thanks for the replies You can get the string that is supposed to be in text field after this method: NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; And

Inner shadow in UITextField with rounded corners

我的梦境 提交于 2019-12-03 13:46:33
问题 I want to implement this UITextField design: In Zeplin here is the properties of the shadow: What I have tried ? override func layoutSubviews() { super.layoutSubviews() self.layer.cornerRadius = self.frame.size.height/2 self.addInnerShadow() } private func addInnerShadow() { let innerShadow = CALayer() innerShadow.frame = bounds // Shadow path (1pt ring around bounds) let path = UIBezierPath(rect: innerShadow.bounds.insetBy(dx: -1, dy: -1)) let cutout = UIBezierPath(rect: innerShadow.bounds)

how to pop up datePicker when text filed click and disappear when editing done

六眼飞鱼酱① 提交于 2019-12-03 13:22:16
i have view something like below date picker view is always there how can i make it appear pop up when Enter date is clicked and when i click on back ground then date picker should go down i have just made date picker view customary but i dont know how to do this appear and disappear thing Fire Fist Ok. Here is some sample code for your requirement with animation. - (void) showView { [self.view addSubview:yourDatePickerView]; yourDatePickerView.frame = CGRectMake(0, -250, 320, 50); [UIView animateWithDuration:1.0 animations:^{ yourDatePickerView.frame = CGRectMake(0, 152, 320, 260); }]; } And

swift playground UITextField spawns keyboard that is too big

有些话、适合烂在心里 提交于 2019-12-03 13:16:05
Swift in playground on Mac OS. When the user clicks in a UItextfield, a keyboard spawns but it is very large compared to the view and only the first few keys are available. minimal example: import UIKit import PlaygroundSupport class TesterViewController : UIViewController { var testTextField : UITextField! override func loadView() { let view = UIView() view.backgroundColor = .white testTextField = UITextField() testTextField.borderStyle = .roundedRect testTextField.text = "" view.addSubview(testTextField) testTextField.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint

How to add text field to inputAccessoryView and make the textView first responder

那年仲夏 提交于 2019-12-03 13:07:13
My code: - (void)viewDidLoad { [super viewDidLoad]; CGRect rectFake = CGRectZero; UITextField *fakeField = [[UITextField alloc] initWithFrame:rectFake]; [self.view addSubview:fakeField]; UIView *av = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 39.0)]; av.backgroundColor = [UIColor darkGrayColor]; CGRect rect = CGRectMake(200.0, 4.0, 400.0, 31.0); UITextField *textField = [[UITextField alloc] initWithFrame:rect]; textField.borderStyle = UITextBorderStyleRoundedRect; textField.font = [UIFont systemFontOfSize:24.0]; textField.delegate = self; [av addSubview:textField]; fakeField

How to create underlined UITextField

泪湿孤枕 提交于 2019-12-03 12:49:31
iOS noob here When I add a default UITextField to the ViewController, it looks like this: My designer would like me to make the UITextField look like this (i.e. background is transparent, and just has an underline: How do I do this? Should be asking my designer for an image to set as background for the UITextField . What should the image look like? Should the image be = the blue background + the underline (minus the number i guess) Is that right? UPDATE : Based on direction below (from @Ashish Kakkad), added this code in Swift to ViewDidLoad: var bottomLine = CALayer() bottomLine.frame =

UITextFieldDelegate vs UITextField control events

折月煮酒 提交于 2019-12-03 12:08:22
If I want to handle changes to a UITextField, such as the user typing in it; it seems like this can be done either by assigning a delegate to that text field, and then having the delegate implement shouldChangeCharactersInRange, or by adding a target to the textField, and handling the UIControlEventEditingChanged event. Aside from the fact that with the delegate method, you can return NO and therefor stop the user from making the edit, is there any difference between these 2 things? Same question for handling the beginning of editing or the ending of editing. It could be done either with the

Execute current UITextField autocorrect suggestion when another button is pressed

冷暖自知 提交于 2019-12-03 11:41:01
问题 I am implementing chat in my application, very similar to the iPhone's built-in Messages app. I have a UITextField next to a button. The user types something into the text field, and very often the text field suggests various autocorrections. In the built-in Messages app, tapping the Send button will cause the currently visible autocorrection suggestion to execute. I am seeking this behavior in my application, but haven't been able to find anything. Does anyone know of a way to

How do I subclass UITextField and override drawPlaceholderInRect to change Placeholder color

孤街醉人 提交于 2019-12-03 11:29:28
问题 I have a 3 UITextField with placeholder text set. On one of the UITextField I want the placeholder text to be red. Now after googling it seems the best way to do this is to subclass UITextField and override drawPlaceholderInRect . How do I go about subclassing and overriding drawPlaceholderInRect ? I've not found any code examples or tutorials on this and I'm new to objective-c and iOS development so finding it tricky to work it out. Answer: Created a new objective-c class called