使用NSMutableArray裏,而是和ADDOBJECT:if(textField1.text.length > 1) then [yourMutableArray addObject:textField1.text];
等等...
事情是這樣的:
// in your interface
UITextField * textField1;
UITextField * textField2;
UITextField * textField3;
NSMutableArray * mainCellTextArray;
//implementation
mainCellTextArray = [[NSMutableArray alloc] init]; // release it later
if(textField1.text.length > 1)
{
[mainCellTextArray addObject:textField1.text];
}
if(textField2.text.length > 1)
{
[mainCellTextArray addObject:textField2.text];
}
if(textField3.text.length > 1)
{
[mainCellTextArray addObject:textField3.text];
}