如何从iPhone sdk中的标签获取文本字段值?
如果我有一个文本字段的标签,那么我如何在iPhone sdk中选择textfield的值
你应该没问题(假设TextField是一个self.view的子视图):
NSString *text = [(UITextField *)[self.view viewWithTag:THE_TAG] text];
NSString * text = [(UITextField *)[self.view viewWithTag:tag] text];
尝试以下一个
UITextField *textField = (UITextField*)[self.view viewWithTag:tag_Number]; NSString* textString=[textField text]; //Use textString further
使用:
UITextField *textField = (UITextField*)[self.view viewWithTag:100]; NSLog(@"%@",textField.text);
您需要使用自己的标签替换100。