要初始化數組中的字符串,如下格式:
-(IBAction)btnSubmit:(UIButton *)sender
{
NSString *phone = phoneNumber.text;
NSLog(@"Phone :%@",phone);
NSString *TxtUserName = userName.text;
NSString *TxtEmailId = emailId.text;
NSArray *details = [NSArray arrayWithObjects:TxtUserName,TxtEmailId,phone,nil];
}
得到的內容:( "xxxxxxx", "[email protected]", 7675 )
但是期望的內容:("Name=xxxx","[email protected]","Phone=8786")
請高手指教,謝謝。
修改代碼如下:
NSString *phone = [NSString stringWithFormat:@"Phone=%@",phoneNumber.text];
NSString *TxtUserName = [NSString stringWithFormat:@"Name=%@",userName.text];
NSString *TxtEmailId = [NSString stringWithFormat:@"Email=%@",emailId.text];
NSArray *details = [NSArray arrayWithObjects:TxtUserName,TxtEmailId,phone,nil];
其實可以考慮放到字典中