我在用
NSString *str_Message;
if ([txt_NoOfPersons.text length] == 0){
bln_Validate = FALSE;
str_Message = [[NSString alloc]initWithString:@"Number of Persons field is required."];
}
else if ([txt_NoOfPersons.text intValue] == 0)
{
bln_Validate = FALSE;
str_Message = [[NSString alloc]initWithString:@"Please enter your guest count."];}
}
if ([txt_DateAndTime.text length] == 0)
{
bln_Validate = FALSE;
str_Message = [[NSStrin@"Date and Time field is required."];
}
如果我使用Nsstring *str_Message=nil; '
if ([txt_NoOfPersons.text length] == 0)
{
bln_Validate = FALSE;
str_Message = @"Number of Persons field is required.";
}
else if ([txt_NoOfPersons.text intValue] == 0)
{
bln_Validate = FALSE;
str_Message = @"Please enter your guest count.";
}
那么Nsstring *str;之间的效果和区别是什么?字符串 *str=nil