私の質問にお答えいただきありがとうございます。
私は最終的に連絡先Qrコード文字列を返す関数を作成します。
簡単ですが長すぎます。
ユーザーからのデータ入力をチェックし、データごとにスティングを追加して文字列を作成する必要があります。
私は自分のコードを投稿しているので、他の人を助け、時間を節約することができます。私は、これはBEGINような文字列を渡す必要
-(NSString *)GenerateStringForContact{
NSString *str = @"";
NSMutableArray *arr1 =[[NSMutableArray alloc] init];
for (int i=0 ; i<[arrayAttributeName count]; i++) {
if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"First Name"]) {
if ([strContactType isEqualToString:@"ContactMecard"]) {
[arr1 addObject:@"N:"];
}else{
[arr1 addObject:@"FN:"];
}
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Last Name"]) {
// [arr1 addObject:@"N:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Phone"]) {
[arr1 addObject:@"TEL:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Email"]) {
[arr1 addObject:@"EMAIL:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"URL"]) {
[arr1 addObject:@"URL:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Nickname"]) {
[arr1 addObject:@"NICKNAME:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Title"]) {
[arr1 addObject:@"TITLE:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Organization"]) {
[arr1 addObject:@"ORG:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Birthday"]) {
[arr1 addObject:@"BDAY:"];
}else if ([[arrayAttributeName objectAtIndex:i] isEqualToString:@"Note"]) {
[arr1 addObject:@"NOTE:"];
}
}
NSMutableArray *contDetail = arrayAttributeValue;
if ([strContactType isEqualToString:@"ContactMecard"]) {
str = @"MECARD:";
// arr1 = [[NSArray alloc] initWithObjects:@"N:",@"TEL:",@"EMAIL:",@"URL:",@"NOTE:",@"NICKNAME:",@"BDAY:",@"ADR:",nil];
}else{
str = @"BEGIN:VCARD";
// arr1 = [[NSArray alloc] initWithObjects:@"N:",@"TEL:",@"EMAIL:",@"URL:",@"NOTE:",@"NICKNAME:",@"BDAY:",@"ADR:",@"TITLE:",@"ORG:",nil];
}
BOOL count = TRUE;
for (int i =0; i <[contDetail count]; i++) {
if (![[contDetail objectAtIndex:i] isEqualToString:@""]) {
NSString *tmp2 [email protected]"";
if (i == 0 || i == 1) {
if (count) {
if ([strContactType isEqualToString:@"ContactMecard"]) {
tmp2 = [NSString stringWithFormat:@"%@,%@",[contDetail objectAtIndex:0],[contDetail objectAtIndex:1]];
NSString *tmp = [NSString stringWithFormat:@"%@%@",[arr1 objectAtIndex:i],tmp2];
str = [NSString stringWithFormat:@"%@;%@",str,tmp];
}else{
tmp2 = [NSString stringWithFormat:@"%@ %@",[contDetail objectAtIndex:0],[contDetail objectAtIndex:1]];
NSString *tmp = [NSString stringWithFormat:@"%@%@",[arr1 objectAtIndex:i],tmp2];
str = [NSString stringWithFormat:@"%@\n%@",str,tmp];
}
count = FALSE;
}
}else{
tmp2 = [contDetail objectAtIndex:i];
NSString *tmp = [NSString stringWithFormat:@"%@%@",[arr1 objectAtIndex:i-1],tmp2];
if ([strContactType isEqualToString:@"ContactMecard"]) {
str = [NSString stringWithFormat:@"%@;%@",str,tmp];
}else{
str = [NSString stringWithFormat:@"%@\n%@",str,tmp];
}
}
}
}
if (![strContactType isEqualToString:@"ContactMecard"]) {
str = [NSString stringWithFormat:@"%@\nEND:VCARD",str];
}
NSLog(@"here string for generate code %@",str);
return str;
}
おかげ....
:VCARD Nを; CHARSET = UTF-8:バビ; sarafaraz ;;; FN; CHARSET = UTF-8:sarafarazバビ TITLE; CHARSET = UTF-8:ソフトウェア開発 TEL; WORK:1234567489 TEL; CELL:12345875 EMAIL; INTERNET; WORK; CHARSET = UTF-8:サフィ@ logisticinfotech ADR;作品;文字列= utf-8:;;;ラージャコット;グアラット;;インド バージョン:2.1 終了:VCARD –
私はこの文字列をスキャンQSLコードから取得しています.. –
? http://snapmyinfo.com/blog/how-to-create-a-business-card-qr-code/ –