我在分配要查看的MKMapView对象时遇到了问题,
UIView *tempView = [[UIView alloc]initWithFrame:CGRectMake(1, 102, 318, 377)];
[self.view addSubview:tempView];
lMapViewTemp = [[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 318, 377)];
lMapViewTemp.delegate = self;
此行问题:
[tempView addSubview:lMapViewTemp]; EXC_BAD_ACCESS (Code=1,address=0xc)
当我将上述结构称为一次时,它的工作正常。之后,
//calling for add contact
- (IBAction)BnEditContact:(id)sender{
UIButton *button = sender;
buttonTag = (int)button.tag;
if(!picker){
picker=[[ABPeoplePickerNavigationController alloc] init];
}
picker.peoplePickerDelegate = self;
[self presentViewController:picker animated:YES completion:nil];
}
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{
[self dismissViewControllerAnimated:YES completion:nil];
return NO;
}
//delegate methods
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person;
{
[self displayPerson:person];
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
//calls displayPerson:(ABRecordRef)person to show contact's information in the app
[self displayPerson:person];
[self dismissViewControllerAnimated:NO completion:NULL];
return NO;
}
我正在接收上述代码中的联系人。现在,如果我再次尝试访问mapView。它提出了问题。