i have a NSMutableArray called delegate.allSelectedVerseEnglish from application delegate, it have some values, i am able to get the array count and i can show it correctly in UITableView. But now i want to display it in a textview. My UITableView code is like this
- (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];
}
}
It shows correct values in the cell, but i just need to show this delegate.allSelectedVerseEnglish array in a textview, like textview.text = delegate.allSelectedVerseEnglish;. How it can be done?
Thanks in advance.
Depends on how you want the text to be formatted.
For logging purposes, I’d use
[delegate.allSelectedVerseEnglish description];while for showing it to the user something like[delegate.allSelectedVerseEnglish componentsJoinedByString:@"\n"];might be suitable.