As something else to post on this blog, I thought I’d add some code help. Going through a number of questions on StackOverflow that’s reached a number of thousand views, I thought I’d post some of them up on here.
To set a text character limit in an NSTextField, the following code should be placed into your view controller and make sure NSTextField delegate is set to self.
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
//limit the size :
int limit = 20;
return !([textField.text length]>limit && [string length] > range.length);
}
2 Responses to Setting Max Characters in an NSTextField [Code Snippet]
Leave a Reply
You must be logged in to post a comment.

Buy:Zocor.Zetia.Nymphomax.Buspar.Benicar.Lipothin.Lipitor.Acomplia.SleepWell.Prozac.Amoxicillin.Lasix.Ventolin.Cozaar.Seroquel.Female Pink Viagra.Female Cialis.Aricept.Wellbutrin SR.Advair….
Buy:Lumigan.Actos.Valtrex.100% Pure Okinawan Coral Calcium.Zyban.Mega Hoodia.Nexium.Accutane.Zovirax.Petcam (Metacam) Oral Suspension.Prevacid.Arimidex.Prednisolone.Synthroid.Human Growth Hormone.Retin-A….