P parkov macrumors newbie Original poster Aug 8, 2008 #1 Newbie question here. How do I extract an int value from a UITextField (textKey)? I have the following: NSInteger inputKey = textKey.text; Which gives me this warning: warning: initialization makes integer from pointer without a cast Thanks!
Newbie question here. How do I extract an int value from a UITextField (textKey)? I have the following: NSInteger inputKey = textKey.text; Which gives me this warning: warning: initialization makes integer from pointer without a cast Thanks!
sfwalter macrumors 68020 Aug 8, 2008 #2 parkov said: Newbie question here. How do I extract an int value from a UITextField (textKey)? I have the following: NSInteger inputKey = textKey.text; Which gives me this warning: warning: initialization makes integer from pointer without a cast Thanks! Click to expand... You can't take an object and assign it to a primitive. NSInteger is really just a typedef of int. You can do this: NSInteger theInteger = [textKey.text intValue];
parkov said: Newbie question here. How do I extract an int value from a UITextField (textKey)? I have the following: NSInteger inputKey = textKey.text; Which gives me this warning: warning: initialization makes integer from pointer without a cast Thanks! Click to expand... You can't take an object and assign it to a primitive. NSInteger is really just a typedef of int. You can do this: NSInteger theInteger = [textKey.text intValue];
P parkov macrumors newbie Original poster Aug 9, 2008 #3 sfwalter said: You can't take an object and assign it to a primitive. NSInteger is really just a typedef of int. You can do this: NSInteger theInteger = [textKey.text intValue]; Click to expand... Thanks. Can you go in the other direction, or do you have to use methods for those as well? For example: creating an NSMutableArray from ints creating an NSString from chars
sfwalter said: You can't take an object and assign it to a primitive. NSInteger is really just a typedef of int. You can do this: NSInteger theInteger = [textKey.text intValue]; Click to expand... Thanks. Can you go in the other direction, or do you have to use methods for those as well? For example: creating an NSMutableArray from ints creating an NSString from chars