It is simple to understand after this pic.
I add fewtextfields in tableview
I already set the keyboard style is number pad.
Now the problems is
1.Do I need to create 12 textfields ???ex. UITextField *ip1,ip2,ip3,ip4....
or just set different tag for textfield ?
2.How to check user enter wrong char not 3 valid numbers
(even the keyboard is set number pad,but it might can paste words...)
3.How to check user did follow this setting rules ???
<1>If IP1 is 0~223 , IP2 need to be set 0~255,IP3,IP4 both are 0~255
<2>If IP1 is 172 ,IP2 is set 16~31.IP3,IP4 both are 0~255; If IP1 is 192 ,IP2 must be 168.IP3 IP4 are 开发者_高级运维0~255
<3>Netmask set default 255.255.255.0
<4>Router 0~223 ,0~255 ,0~255 ,0~255
This IP setting rules is my friends tech me this ...I not sure the rules is right or not?
--------ADD---------
Oh....Sorry , I need to add more information about is static IP
This static IP setting is set up for some hardware device ,ex IP cam
so it won't need to paste a URL
I despise programs that force me to type the components of an IP address into separate fields. It is awkward to type addresses in, and worst of all I can't paste IP addresses in or out. Just use a single field for each address, and validate what the user enters.
To validate manually, split the entry on '.'
and test that each substring correctly converts to an integer in the range [0, 255]. You could check more precisely, but if the intent is to connect to an existing network, checking that the first component is < 224 won't help at all if the user incorrectly typed 213 instead of 123.
精彩评论