Rovnake možnosti ine odpovede

Věnujete se vývoji aplikací pro Mac OS X, iOS nebo třeba webových služeb spojených s Apple produkty. Nabízíme prostor pro sdílení zkušeností.

Moderátoři: MichalM.Mac, zmiy, dandas, Macforum_Admin

Odpovědět
patffo
Příspěvky: 5
Registrován: 07 dub 2014 14:17

Rovnake možnosti ine odpovede

Příspěvek od patffo » 20 dub 2014 23:21

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".

syky01
Příspěvky: 312
Registrován: 31 črc 2012 09:36

Re: Rovnake možnosti ine odpovede

Příspěvek od syky01 » 20 dub 2014 23:27

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)

patffo
Příspěvky: 5
Registrován: 07 dub 2014 14:17

Re: Rovnake možnosti ine odpovede

Příspěvek od patffo » 20 dub 2014 23:34

mam to robene takto (su to len vybrane kody, snad to staci co som napisal) :

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;
    }
}
potom

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];

patffo
Příspěvky: 5
Registrován: 07 dub 2014 14:17

Re: Rovnake možnosti ine odpovede

Příspěvek od patffo » 21 dub 2014 00:16

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?

Odpovědět