我无法在@synthesize mCallnumber
中声明Callmethod
。如果我声明它是抛出错误,当我尝试在标题中声明它时,它也会抛出错误并且应用程序被终止。作为我的帮助我对这个Objective-C很新。
-(IBAction)gotohomepage:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
mContactNumber.text=@"";
mEmailId.text=@"";
mFirstName.text=@"";
mLastName.text=@"";
mFirstName.text=(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
mLastName.text=(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
ABMultiValueRef phoneIdIndex=ABRecordCopyValue(person,kABPersonPhoneProperty);
CFIndex thePhoneIndex=ABMultiValueGetCount(phoneIdIndex);
if (thePhoneIndex!=0) {
mPhoneNumber=(NSString *)ABMultiValueCopyValueAtIndex(phoneIdIndex, 0);
mContactNumber.text=mPhoneNumber;
}
ABMultiValueRef emailIdIndex=ABRecordCopyValue(person, kABPersonEmailProperty);
CFIndex theEmailIndex=ABMultiValueGetCount(emailIdIndex);
if (theEmailIndex!=0) {
mEmailIdIndex=(NSString *)ABMultiValueCopyValueAtIndex(emailIdIndex, 0);
mEmailId.text=mEmailIdIndex;
}
[self dismissModalViewControllerAnimated:YES];
mCall.hidden=NO;
mEmail.hidden=NO;
mSMS.hidden=NO;
return NO;
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
return YES;
}
-(IBAction)callmethod
{
contactsViewController *actionHandleView=[[contactsViewController alloc]initWithNibName:@"contactsViewController" bundle:nil];
actionHandleView.mCallNumber=mPhoneNumber;
[self.navigationController pushViewController:actionHandleView animated:YES];
[actionHandleView release];
}
答案 0 :(得分:0)
您很可能只需要添加一行说明:
@property (retain) NSString * mCallNumber;
到您的“contactsViewController
”。h文件。
B.T.W。,Objective C最佳实践是将类名的第一个字符大写,并将所有变量的第一个字符保持为小写。因此,而不是“contactsViewController
”,将其称为“ContactsViewController
”。
答案 1 :(得分:0)
试试这个,看它是否有效。
@property(nonatomic,retain) NSString *mCallNumber;