22 Apr
Posted by Ultra MCU as Computer, Programming
พอดีว่าง ๆ เลยหาโหลด IPhone SDK มาลองเล่น ๆ ดู เขียนไปมึน ๆ ไปก็มัน ๆ ดี
สมมุติว่า เรามี TextField(Windows เรียก TextBox) อันนึง TagId = 1
แล้วเราต้องการ Convert ไปใส่ในตัวแปล Int หรือ Float
UITextField *txtNumber = (UITextField *)[window viewWithTag:1];
float fNumber;
fNumber = [[txtNumber text] floatValue];
float nNumber;
nNumber = [[txtNumber text] intValue];
และถ้าเราอยาก Convert จาก Int/Float เป็น String ลงใน text field
txtShowF.text = [NSString stringWithFormat:@"%f", fNumber];
txtShowN.text = [NSString stringWithFormat:@"%n", nNumber];
Reference :
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | ||
RSS feed for comments on this post · TrackBack URI
Leave a reply