我有一个名为delegate.allSelectedVerseEnglish的应用程序委托的NSMutableArray,它有一些值,我能够获得数组数并且我可以在UITableView中正确显示它。但是现在我想在textview中显示它。我UITableView的代码是这样的将NSArray转换为IOS中的NSstring
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [delegate.allSelectedVerseEnglish count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
readCell *cell = (readCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"readCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.label.text = [NSString stringWithFormat:@"%d",indexPath.row+1];
cell.textLabel.text = [NSString stringWithFormat:@" %@",[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row]];
cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:19.0];
}
}
它在细胞中显示正确的价值观,但我只需要显示此delegate.allSelectedVerseEnglish阵列在一个TextView,像textview.text = delegate.allSelectedVerseEnglish;
。如何做到这一点?
在此先感谢。
感谢您的答复,,所以我必须写textview.text = [delegate.allSelectedVerseEnglish componentsJoinedByString:@ “\ n”];对? – stackiphone 2012-04-22 07:58:03
是的,这应该做的伎俩。 – 2012-04-22 08:00:48
让我试试这个。谢谢 – stackiphone 2012-04-22 08:01:26