【发布时间】:2013-01-22 07:59:00
【问题描述】:
我正在使用
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; 之间的区别是什么? nsstring *str=nil
【问题讨论】:
-
我想知道它们之间有什么区别,只将它设置为 nil 删除垃圾值
标签: iphone ios objective-c xcode