UITextField Craziness

时间:2009-10-03 20:09:42

标签: iphone uitextfield

所以这是删节代码:

 - (void)viewDidLoad {
        [super viewDidLoad];
        currentLocation = [[UITextField alloc] init];
        currentLocation.delegate = self;
    ........
    }

    -(void) setState:(NSString *)state andCity: (NSString *)city {

        //currentLocation.text = [NSString stringWithFormat:@"%@, %@",state,city];
        currentLocation.text = @"what the shnizzle?";

        NSLog(@"state = %@, and city = %@",state,city);
        NSLog(@"currentLocation.text = %@",currentLocation.text);
}

这是控制台输出:

2009-10-03 16:00:06.311 iParkNow![1061:207] state = (null), and city = New York
2009-10-03 16:00:06.315 iParkNow![1061:207] currentLocation.text = (null)

任何人都知道这是怎么可能的?

1 个答案:

答案 0 :(得分:1)

看起来currentLocation是零。你确认它已经设置得当吗?