Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to go on next page from cell tableView to 2 page
    primarykey
    data
    text
    <p>I create one page with name ViewControll that is tableview. I read 2 group NSString from url and store that in NSMutableArray. (names : file &amp; folder) and both array store one array with name:(all) this NSMutableArray display in root page (ViewController)</p> <p>I have two page another with names: (TabelViewController &amp; DetailViewController) that TabelViewController is for folder array and DetailViewController is for file array.</p> <p>I want when to click on cell if that cell is from folder array go on to TableViewController page else if that cell is from file array go on to DetailViewController page. </p> <p>this is my code but dont work!!!: <strong>ViewController.h</strong></p> <pre><code>@interface ViewController : UITableViewController { NSMutableArray *folder; NSMutableArray *file; NSMutableArray *all; NSInteger folderNumber,fileNumber; } @property (nonatomic,strong) IBOutlet UITableView *tables; @end </code></pre> <p><strong>ViewController.m</strong></p> <pre><code>@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSString *Number1 = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@"http://192.168.1.101/mamal/filemanager.php?dir=root&amp;filenum"]]; fileNumber = [Number1 integerValue]; NSString *Number2 = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@"http://192.168.1.101/mamal/filemanager.php?dir=root&amp;foldernum"]]; folderNumber = [Number2 integerValue]; NSLog(@"file: %d &amp; folder: %d",fileNumber,folderNumber); for (int i=0; i &lt; folderNumber; i++) { NSString *folderName = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.1.101/mamal/filemanager.php?dir=root&amp;folder=%d&amp;name",i]]]; if (!folder) { folder = [NSMutableArray array]; } [folder addObject:folderName]; } for (int j=0; j &lt; fileNumber; j++) { NSString *fileName = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://192.168.1.101/mamal/filemanager.php?dir=root&amp;file=%d&amp;name",j]]]; NSLog(@"%@",fileName); if (!file) { file = [NSMutableArray array]; } [file addObject:fileName]; } all = [[NSMutableArray alloc]init]; [all addObjectsFromArray:folder]; [all addObjectsFromArray:file]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return all.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } cell.textLabel.text = [all objectAtIndex:indexPath.row]; return cell; } #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"%d",indexPath.row+1); if (indexPath.row+1 &lt;= folderNumber) { TableViewController *tab = [[TableViewController alloc]init]; [self.navigationController pushViewController:tab animated:YES]; } else { if (indexPath.row+1 &gt; folderNumber) { DetailViewController *detail = [[DetailViewController alloc]init]; [self.navigationController pushViewController:detail animated:YES]; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload