Limit Characters - Like Twitter! (Swift in Xcode)

preview_player
Показать описание
Thanks for watching! Be sure to subscribe and recommend future videos. :)

Snapchat! - archetapp

Рекомендации по теме
Комментарии
Автор

Will not work if the user copies and pastes text into the field.

Nina-qtnb
Автор

Hey Jared, I love your tuts. Please keep on :)

HakkiKonu
Автор

Instead of using:
count(myTextField)

do:


dubelan
Автор

hi jared
i created:
5 buttons :
buttonA
buttonB
buttonC
buttonD
buttonE

the buttons (buttonB buttonC buttonD buttonE) are hidden

the play is:
i click on buttonA, buttonB will appear
i click on buttonB, buttonC will appear
i click on buttonC, buttonD will appear
i click on buttonD, buttonE will appear

the problem is:
i click buttonC, buttonD will appear, but the user can't see it, bcz its outside the screen size.

what i want to do is, when i click on buttonC, the screen automatically slide down to show buttonD at the bottom of the screen, so i can click on buttonD, and the screen will slide down again to show buttonE :)

thanks

anthonyaustralia
Автор

Great video Jared!! Any chance you could do a video on how to record video with the built in camera?

What would also be great is how to save a retrieve this newly recorded video to/form Parse.

One more great video would be how to enable editing picture controls when taking a picture with the UIImagePickerController.

Leep up the great vids :)

djskywalkerremix
Автор

Hi Jared! Great video! I've got an issue though. If I try to connect a label that tells me how many characters are left to type I get an error off by one when I type the first character and the last one. Do you know what the issue could be? Thanks!

DaviNasta
Автор

shouldcharterinrange not available in swift 4 can you update
thanks

richardgomez
Автор

I use one more ShouldChangeCharactersIn method for blocking some characters. For this reason, I can't use this. How can I mix two of them ?

TahaS
Автор

Hey, can you help or do a video on character limit on strings for a label. Thanks.

slammerw
Автор

error Message: "Cannot invoke 'count' with an argument list of type '(String)'"
How to fix it Mr.Jared Devidson ?

khungsokhim
Автор

Please help... My textfield is set to only accept number using the number pad keyboard. I have followed this video repeatedly but I keep getting an error in the code that says "Cannot invoke 'count' with an argument list type of '(String)?'

My goal is to have a textfield that only accepts two digits for the user's age. The user will only have the option to use the number pad to input their age. Thanks

michaelwitt
Автор

Hey Jared, seems like i cant delete the input once I reach the limit. any clues how can i fix that? thank you

kantarlin
Автор

hi nice tutorial need help something is not right with my code
count is giving me an error
here is my code

im using xcode 8.2.1


@IBAction func tipobegin(_ sender: Any) {


func TextField(TextField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {

if range.length + range.location > (tipo.text!.characters.count) {
return false

}
let newLength = (tipo.text!.characters.count) + (string.characters.count) - range.length
return newLength <= 5

}

richardgomez
Автор

Have you submitten any apps to AppStore?:)

opensourcerer
Автор

what about swift 3? this aint working :/

bilalakram
Автор

what about swift 3 cuz this code doesn't run :/

SpellOdyssey
Автор

User copy and paste 50character text four times?

emreciftci
Автор

working code as of today 5th july 2017

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

let text = username.text!;

let newlength = text.characters.count + string.characters.count;

return newlength <= 5;

}

JulianAilemen_i
Автор

This logic won't work for copy and pasting.

pravalikad
Автор

this code working as of today 26/5/2017

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

let currentCharacterCount = ?? 0
if (range.length + range.location > currentCharacterCount){
return false
}
let newLength = currentCharacterCount + string.characters.count - range.length
return newLength <= 5
}

Bennyclay