display checkmark on UITextField righthand side - uitextfield

I am trying to display checkmark on UITextField righthandside on tapGesture.
Could you please help me to achieve this.

Check below link for what you exactly looking for
http://dhawaldawar.wordpress.com/2014/06/11/uitextfield-validation-ios/
I have created inherited class of UITextField for validating input effectively, you just need to give regex string in sequence for validation on a particular field and other things like show error on right side and showing popup with a message that we provided at the time of assigning regex will handle by class itself.
I'm damm sure it will save your lot of work...

Related

Custom UITableViewCell with UITextField editingDidEnd race condition

I have UITableViewController with Edit/Save button as BarItem. I have a custom cell which displays UITextField in edit mode. I am able to save modified text when I move focus to another cell etc. no problem. However my problem begins when I attempt to modify a field and press Save button that triggers setEditing:NO save etc. What I believe is happening is a race condition where Save action is triggered before editingDidEnd is processed and as a result I am not saving all of the data.
Any suggestions on how to handle this? Am I to go through all visible cells to save all of the data on save? I can definitely do that, but am I going to get into same problem with scroll and edit button clicked? Is there a better way to flush messaging queue?
Given that I have no takers, I think I am stuck with what I know:
in done/save (i.e. setEditing:NO) handling go through all cells and save their data
Keep updating data every time there is a change i.e. in Value Changed perhaps
attempt using UITextFieldDelegate and textFieldShouldEndEditing but I am not sure this would work since I will probably run into the same problem that I have.
I believe endEditing inside setEditing will solve the problem as it supposed to resign first responders for text fields.

Display message when the cursor is over the NSSearchField

I need to display a message similar the following attachmnet
I dont know the technical term what exactly it called in cocoa terminology.
So,I could not google it also.just I am interested to know how can I implement this feature.
They're called tooltips and can be added to any view. You can add them programmatically like so:
[searchField setToolTip:#"Hello World!"];

Cocoa: Accessibility (VoiceOver) for buttons with image only

I use NSButton with empty title and image on it, and it cannot be accessed with VoiceOver.
But when I'm setting title (VoiceOver seems to use title), NSButton tries to show it.
I think there should be an easy way to not display title, or to set button text, used by VoiceOver, however quick search didn't give any results yet.
P.S. I'm creating button programmatically.
you must assign the accessibilityLabel to the image object directly, It works this way.
Solved issue - added subclass for NSButtonCell, which does nothing in drawTitle: method and returns NSZeroRect. Seems to work ok.

Links in NSTableView NSCell

I have been reading and experimenting with allowing links in a custom drawn NSCell for the last few days and have basically got nothing usable, there's always issues with each approach.
Does anyone know of a way of doing this that works?
I am custom drawing the NSCell using - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView *)theControlViewm
The NSCell is just a variable height block of text with links inside it, some cells have links, some do not.
I've tried using nsattributedstring with NSLinkAttributeName
I've tried intercepting all hits to the cell and then trying to match up where they clicked to where the link would be in the text but that never works out.
I've basically tried all suggestions that I could find on all boards but most comments are old so I'm hoping someone has figured out a good way to do this.
Thanks, David
I haven't tried this exactly, but give this a try:
First, for hyperlinks I use a category on NSAttributedString, akin to this post from Apple developer docs. The example here gives you a method on NSAttributedString 'hyperlinkFromString:withURL:`
Second, create a delegate for the table, and implement tableView:willDisplayCell:forTableColumn:row: method.
In that method,
setAttributedStringValue:[NSAttributedString hyperlinkFromString:YOUR_STRING withURL:YOUR_URL]
or, if you need non-hyperlinked string text as well,
setAttributedStringValue:[SOME_NON_HYPERLINKED_STRING appendAttributedString:[NSAttributedString hyperlinkFromString:YOUR_STRING withURL:YOUR_URL]]
If that is the only reason you are custom drawing an NSCell, you can try getting rid of your custom class, because this should work with an NSTextFieldCell. I've seen online, though, that some people have had trouble with centering attributed strings in text field cells, so I hope it works ok. One other caveat: with the delegate method, be sure that you set the cell attribute that you are changing for all conditions. I quote:
Because aCell is reused for every row in aTableColumn, the delegate must set the display attributes both when drawing special cells and when drawing normal cells.
from "http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html" (sorry, StackOverflow won't let me post more than one hyperlink yet)
Hope this helps.

Importance of Direction of Control-Drag Operation while Setting Actions in Interface Builder

I have a question regarding the importance of choosing the correct starting and ending points of a control-drag operation while setting actions using Interface Builder (3.2.3). This issue came up while working through an example in an introductory text. In the example project there is a very simple graphical window with a three NSTextFields (i.e. First Name, Last Name, Email) and one NSTextView. The interface for the controller class is declared in the header file as:
#interface EmailController : NSObject {
IBOutlet NSTextField *emailField;
IBOutlet NSTextField *firstNameField;
IBOutlet NSTextField *lastNameField;
IBOutlet NSTextView *resultTextView;
}
- (IBAction)textFieldChanged:(id)sender;
#end
The text makes a point in stating that when setting an action you begin the control-drag at the control. Specifically, the example starts with a control-drag from the First Name editable NSTextField text field to the EmailController instance where a small black window appears and where the action textFieldChanged action can be selected.
After the First Name editable box is connected to the action the text directs the reader to also connect the Last Name and Email editable boxes to the same action. However in these cases the text directs the reader to start the control-drag operation from the small circle to the right side of the textFieldChanged action in the black window of the controller instance and to end at the Last Name and Email editable boxes. This seems opposite to how I understand the general rule of starting at the control while setting an action.
No matter which points I choose as my start and my end I seem to get the same result. The actions listed in the Connector Inspector for the various objects always seem indifferent to which point I choose as my start. I wouldn't even consider it an issue if it wasn't that it seemed contradictory to the explicitly stated general rule. I did notice a problem when I tried doing the same thing with outlets.
Does it matter which point you choose as the start when connecting a control to an action?
Thanks
Does it matter which point you choose as the start when connecting a control to an action?
No.
Big Nerd Ranch recommends always dragging from sender to receiver (outlet to object or control to target) to make clear which direction the message(s) will go in. It's equally valid to drag in the other direction, but does not reinforce the message direction to new Cocoa and Cocoa Touch programmers.
(To be clear, that blog is authored by a former BNR class attendee, not by BNR or anyone working for BNR.)
After the First Name editable box is connected to the action the text directs the reader to also connect the Last Name and Email editable boxes to the same action. However in these cases the text directs the reader to start the control-drag operation from the small circle to the right side of the textFieldChanged action in the black window of the controller instance and to end at the Last Name and Email editable boxes. This seems opposite to how I understand the general rule of starting at the control while setting an action.
One advantage of the right-click-on-action-receiver-and-drag-from-the-actions way is that it's easier to connect a bunch of actions at once. That sounds like the best reason for the tutorial making an exception there, aside from just being by a different author or authors (I'm guessing) with a different way of doing things.

Resources