sta*_*one 0 iphone nsstring nsarray ios
我有一个名为delegate.allSelectedVerseEnglish的NSMutableArray来自应用程序委托,它有一些值,我能够获得数组计数,我可以在UITableView中正确显示它.但现在我想在textview中显示它.我的UITableView代码是这样的
- (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];
}
}
Run Code Online (Sandbox Code Playgroud)
它在单元格中显示正确的值,但我只需要在textview中显示此delegate.allSelectedVerseEnglish数组,例如textview.text = delegate.allSelectedVerseEnglish;.怎么做?
提前致谢.
取决于您希望如何格式化文本.
出于记录目的,我会使用[delegate.allSelectedVerseEnglish description];while向用户显示[delegate.allSelectedVerseEnglish componentsJoinedByString:@"\n"];可能适合的内容.
| 归档时间: |
|
| 查看次数: |
2098 次 |
| 最近记录: |