Zdravím,
hrajem sa v xcode a "robim" aplikaciu kde si zistis kedy ti pride bus no mam taky problem že
Vyberem si dajme tomu zástavku "A" , vyberem si autobus "1" a zobrazi sa mi "C"
ale ked si vyberem zástavku "B", zase autobus "1" zase sa mi zobrazí "C" ale ja chcem aby tam bola ina odpoved "X"
Podstata toho je že mam rovnake autobusy ale chcem ine časy. Pretože mam to zrobene tak že ked kliknem na autobus "1" zobrazí sa mi "C" ale problem je že ja ich mam viac tych autobusov "1" takže všade je to "C".
Rovnake možnosti ine odpovede
Moderátoři: MichalM.Mac, zmiy, dandas, Macforum_Admin
Re: Rovnake možnosti ine odpovede
Zní to zmateně. Byla by ukázka kódu? Jinak bych řekl, že je potřeba trojrozměrne pole.
Mac (Mini 2012) Macbook Pro (2016TouchBar, 2021 M1 Pro), iPad (Air, Pro 10.5), iPhone (6S, 8, 13mini), iPod (nano 6G), aTV (4, 4K), Watch (S2, S7)
Re: Rovnake možnosti ine odpovede
mam to robene takto (su to len vybrane kody, snad to staci co som napisal) :
potom
Kód: Vybrat vše
Bajkalská = [NSArray arrayWithObjects:@"2 - Obr. mieru", @"5 - Bajkalská",@"12 - Jánošikova",@"43 - Veľká pošta", nil];
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if ([_zastavka isEqualToString:@"Bajkalská"]) {
return [Bajkalská count];
- (TableViewCell_2 *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"TableViewCell_2";
TableViewCell_2 *cell = (TableViewCell_2 *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[TableViewCell_2 alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
if ([_zastavka isEqualToString:@"Bajkalská"]) {
cell.textLabel.text = [Bajkalská objectAtIndex:indexPath.row];
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"arrayDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
TableViewController_4 *destViewController = segue.destinationViewController;
destViewController.cas = [Bajkalská objectAtIndex:indexPath.row];
destViewController.title = destViewController.cas;
}
}
Kód: Vybrat vše
test = [NSArray arrayWithObjects:@"17 : 11", nil];
if ([_cas isEqualToString:@"2 - Obr. mieru"]) {
return [test count];
- (TableViewCell_4 *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"TableViewCell_4";
TableViewCell_4 *cell = (TableViewCell_4 *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[TableViewCell_4 alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
if ([_cas isEqualToString:@"2 - Obr. mieru"]) {
cell.textLabel.text = [test objectAtIndex:indexPath.row];
Re: Rovnake možnosti ine odpovede
prišiel som na jednu vec ale potrebujem toto
destViewController.cas = [Bajkalská objectAtIndex:indexPath.row];
bajkalska je NSArray ale ja tych NSArray mam viac ako ich tam zapíšem viac?
destViewController.cas = [Bajkalská objectAtIndex:indexPath.row];
bajkalska je NSArray ale ja tych NSArray mam viac ako ich tam zapíšem viac?