如何在iphone的文本字段上附加数组

| 我有一个应用程序,我想在其中使用特定的ID列从数据库中获取内容,然后在按下按钮时在文本字段中显示所有内容。以下代码段显示了如何获取数组中的内容。
//this is a function which i am created which will be called in button click event  
-(NSArray*)getStudents 
{ 
    NSMutableArray *studentArray=[[NSMutableArray alloc]init]; 

    sqlite3_stmt *statement = nil; 
    NSString *query=@\"select * from UserInformation where UserId=?\"; 
    const char *sql = [query cStringUsingEncoding:NSUTF8StringEncoding]; 
    if (sqlite3_prepare_v2(dbConnection, sql, -1, &statement, NULL) == SQLITE_OK) { 
        while(sqlite3_step(statement) == SQLITE_ROW) { 
            Student *newStudent=[[Student alloc]init]; 
            newStudent.age=sqlite3_column_int(statement, 0); 
            newStudent.name=[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]; 
            [studentArray addObject:newStudent]; 
        } 
    } 

    return studentArray; 
}
我在将此数组添加到我的文本字段时遇到问题,因此当我单击按钮时,我的文本字段会从数据库中加载特定ѭ1的值。我已经在一个控制器中编写了上述函数,并且在另一个控制器中定义了文本字段。如何在文本字段中填写以上数组?     
已邀请:
        在下面用作参考代码..
//Get all your student object from database
NSArray* myArray = [self getStudents ];
//Use mutable string to append all the data in single string.
NSMutableString* stringName = [NSMutableString stringWithString:@\"\"];

//Traverse through the Student array 
for(id arrayObj in myArray)
{
  Student* student = (Student*)arrayObj; 
  [stringName appendString:student.name];
  [stringName appendString:@\" \";
}

//Now you have stringName variable holding all the student name and this is space      separated  string 
myTextField.text = stringName;
    

要回复问题请先登录注册