我在我的代碼中出現訪問錯誤,我不明白爲什麼。 請儘快幫忙。 這裏是我的代碼得到一個EXC_BAD_ACCESS(code = 2,地址= 0x0)錯誤
-(IBAction)datePickerValueChanged:(UIDatePicker *)sender{
myDatePicker = [[myDatePickerView subviews] lastObject];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:sender.locale];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
activeTextField = (UITextField *) [self.view viewWithTag: *(tag)];
[activeTextField setText:[dateFormatter stringFromDate:[sender date]]];
}
PS:我創建了activeTextField財產在@interface,像這樣
@property (nonatomic,strong) UITextField *activeTextField;
和我合成它
@synthesize activeTextField;
這是什麼'*(標籤)'? –
它在哪一行打斷excaclty,什麼是*(tag)? –
標記是UIView的一個屬性,@property(nonatomic)NSInteger * tag; – iOSMaster