Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:42:38+00:00 2026-06-18T08:42:38+00:00

I’m having an error when trying to pass a bunch of variables from one

  • 0

I’m having an error when trying to pass a bunch of variables from one class to another, my first class controls one view, and my other class is a tableviewcontroller that controls a table view, I have a segue named “shoplistSegue” and when I click one button it performs the segue and pass variables using “prepareForSegue” method. but when I click the button it freezes and an error appears “unrecognized selector sent to instance 0x74af950”.

class1.h

@interface CalcularViewController : UIViewController{

    int calcularIntHomens;
    int calcularIntMulheres;
    int calcularIntCriancas;

}
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelHomens;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelMulheres;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelCriancas;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelFantasmas;
@property int calcularIntHomens;
@property int calcularIntMulheres;
@property int calcularIntCriancas;
- (IBAction)subtractHomens:(id)sender;
- (IBAction)subtractMulheres:(id)sender;
- (IBAction)subtractCriancas:(id)sender;
- (IBAction)addHomens:(id)sender;
- (IBAction)addMulheres:(id)sender;
- (IBAction)addCriancas:(id)sender;
- (IBAction)showResultsIfNotNull:(id)sender;

@end

class1.m

#import "CalcularViewController.h"
#import "ResultadoViewController.h"

@interface CalcularViewController ()

@end

@implementation CalcularViewController
@synthesize calcularIntCriancas, calcularIntHomens, calcularIntMulheres, calcularLabelCriancas, calcularLabelHomens, calcularLabelMulheres, calcularLabelFantasmas;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)subtractHomens:(id)sender {

    if (calcularIntHomens > 0) {
    calcularIntHomens = calcularIntHomens -1;
    NSString *submen = [[NSString alloc] initWithFormat:@"%i", calcularIntHomens];
    calcularLabelHomens.text = submen;
    }

}
- (IBAction)subtractMulheres:(id)sender{

    if (calcularIntMulheres > 0) {
    calcularIntMulheres = calcularIntMulheres -1;
    NSString *subwoman = [[NSString alloc] initWithFormat:@"%i", calcularIntMulheres];
    calcularLabelMulheres.text = subwoman;
    }

}
- (IBAction)subtractCriancas:(id)sender{

    if (calcularIntCriancas > 0) {
    calcularIntCriancas = calcularIntCriancas -1;
    NSString *subchild = [[NSString alloc] initWithFormat:@"%i", calcularIntCriancas];
    calcularLabelCriancas.text = subchild;
    }
}
- (IBAction)addCriancas:(id)sender{

    calcularIntCriancas = calcularIntCriancas +1;
    NSString *addchild = [[NSString alloc] initWithFormat:@"%i", calcularIntCriancas];
    calcularLabelCriancas.text = addchild;
}
- (IBAction)addHomens:(id)sender{

    calcularIntHomens = calcularIntHomens +1;
    NSString *addmen = [[NSString alloc] initWithFormat:@"%i", calcularIntHomens];
    calcularLabelHomens.text = addmen;
}
- (IBAction)addMulheres:(id)sender{

    calcularIntMulheres = calcularIntMulheres +1;
    NSString *addwoman = [[NSString alloc] initWithFormat:@"%i", calcularIntMulheres];
    calcularLabelMulheres.text = addwoman;
}

-(IBAction)showResultsIfNotNull:(id)sender{

    if (calcularIntHomens == 0) {
        if (calcularIntMulheres == 0) {
            if (calcularIntCriancas == 0) {
                calcularLabelFantasmas.text = @"Você vai fazer um churrasco pra fantasmas?";
            } else {
                [self performSegueWithIdentifier:@"resultadoSegue" sender:self];
            }
        } else {
            [self performSegueWithIdentifier:@"resultadoSegue" sender:self];

        }
    } else {
        [self performSegueWithIdentifier:@"resultadoSegue" sender:self];

    }

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"resultadoSegue"]) {

        ResultadoViewController *resultados = [segue destinationViewController];

        resultados.resultadoIntCriancas = calcularIntCriancas;
        resultados.resultadoIntHomens = calcularIntHomens;
        resultados.resultadoIntMulheres = calcularIntMulheres;

    }
}
@end

class2.h

#import <UIKit/UIKit.h>

@interface ResultadoViewController : UIViewController{

    int resultadoIntHomens;
    int resultadoIntMulheres;
    int resultadoIntCriancas;
    IBOutlet UIScrollView *scroller;
    float resultadoGado;
    float resultadoFrango;
    float resultadoPorco;
    float resultadoLinguica;
    float resultadoQueijo;
    float resultadoPaodealho;
    float resultadoAcompanhamento;
    float resultadoAbacaxiassado;
    float resultadoCebolaassada;
    float resultadoBebidas;
    float resultadoAlcool;
    int areThereBebidas;
    BOOL picanhaBOOL;
    BOOL alcatraBOOL;
    BOOL maminhaBOOL;
    BOOL contrafileBOOL;
    BOOL lombinhoBOOL;
    BOOL linguicaBOOL;
    BOOL coracaoBOOL;
    BOOL asaBOOL;
    BOOL coxaBOOL;
    BOOL queijoBOOL;
    BOOL paodealhoBOOL;
    BOOL arrozBOOL;
    BOOL farofaBOOL;
    BOOL vinagreteBOOL;
    BOOL maionesesaladaBOOL;
    BOOL saladaBOOL;
    BOOL abacaxiassadoBOOL;
    BOOL cebolaBOOL;
    BOOL cervejaBOOL;
    BOOL refriBOOL;
    BOOL aguaBOOL;
    BOOL vodkaBOOL;
    BOOL sucoBOOL;
    int gadoTotal;
    int frangoTotal;
    int acompanhamentoTotal;
    int bebidaTotal;
    int something;
    int alcoolTotal;


}
@property int alcoolTotal;
@property int areThereBebidas;
@property float resultadoAlcool;
@property int resultadoIntHomens;
@property int resultadoIntMulheres;
@property int resultadoIntCriancas;
@property float resultadoGado;
@property float resultadoFrango;
@property float resultadoPorco;
@property float resultadoLinguica;
@property float resultadoQueijo;
@property float resultadoPaodealho;
@property float resultadoAcompanhamento;
@property float resultadoAbacaxiassado;
@property float resultadoCebolaassada;
@property float resultadoBebidas;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelPicanha;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelAlcatra;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelMaminha;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelContrafile;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelLombinho;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelLinguica;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelCoracao;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelAsa;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelCoxa;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelQueijo;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelPaodealho;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelArroz;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelFarofa;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelVinagrete;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelSaladamaionese;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelSalada;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelAbacaxiassado;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelCebola;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelCerveja;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelRefri;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelAgua;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelVodka;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelSuco;
@property (strong, nonatomic) IBOutlet UILabel *resultadoLabelFome;
- (IBAction)addPicanha:(id)sender;
- (IBAction)addAlcatra:(id)sender;
- (IBAction)addMaminha:(id)sender;
- (IBAction)addContrafile:(id)sender;
- (IBAction)addLombinho:(id)sender;
- (IBAction)addLinguica:(id)sender;
- (IBAction)addCoracao:(id)sender;
- (IBAction)addAsa:(id)sender;
- (IBAction)addCoxa:(id)sender;
- (IBAction)addQueijo:(id)sender;
- (IBAction)addPaodealho:(id)sender;
- (IBAction)addArroz:(id)sender;
- (IBAction)addFarofa:(id)sender;
- (IBAction)addVinagrete:(id)sender;
- (IBAction)addSaladamaionese:(id)sender;
- (IBAction)addSalada:(id)sender;
- (IBAction)addAbacaxi:(id)sender;
- (IBAction)AddCebola:(id)sender;
- (IBAction)addCerveja:(id)sender;
- (IBAction)addRefri:(id)sender;
- (IBAction)addAgua:(id)sender;
- (IBAction)addVodka:(id)sender;
- (IBAction)addSuco:(id)sender;
- (IBAction)buttonBack:(id)sender;
- (IBAction)buttonNext:(id)sender;
@property BOOL picanhaBOOL;
@property BOOL alcatraBOOL;
@property BOOL maminhaBOOL;
@property BOOL contrafileBOOL;
@property BOOL lombinhoBOOL;
@property BOOL linguicaBOOL;
@property BOOL coracaoBOOL;
@property BOOL asaBOOL;
@property BOOL coxaBOOL;
@property BOOL queijoBOOL;
@property BOOL paodealhoBOOL;
@property BOOL arrozBOOL;
@property BOOL farofaBOOL;
@property BOOL vinagreteBOOL;
@property BOOL maionesesaladaBOOL;
@property BOOL saladaBOOL;
@property BOOL abacaxiassadoBOOL;
@property BOOL cebolaBOOL;
@property BOOL cervejaBOOL;
@property BOOL refriBOOL;
@property BOOL aguaBOOL;
@property BOOL vodkaBOOL;
@property BOOL sucoBOOL;
@property int gadoTotal;
@property int frangoTotal;
@property int acompanhamentoTotal;
@property int bebidaTotal;
@property int something;


@end

class2.m

#import "ResultadoViewController.h"
#import "ShoplistViewController.h"

@interface ResultadoViewController ()

@end

@implementation ResultadoViewController
@synthesize resultadoIntCriancas, resultadoIntHomens, resultadoIntMulheres, resultadoAbacaxiassado, resultadoAcompanhamento, resultadoBebidas, resultadoCebolaassada, resultadoFrango, resultadoGado, resultadoLinguica, resultadoPaodealho, resultadoPorco, resultadoQueijo, resultadoLabelAbacaxiassado, resultadoLabelAgua, resultadoLabelAlcatra, resultadoLabelArroz, resultadoLabelAsa, resultadoLabelCebola, resultadoLabelCerveja, resultadoLabelContrafile, resultadoLabelCoracao, resultadoLabelCoxa, resultadoLabelFarofa, resultadoLabelFome, resultadoLabelLinguica, resultadoLabelLombinho, resultadoLabelMaminha, resultadoLabelPaodealho, resultadoLabelPicanha, resultadoLabelQueijo, resultadoLabelRefri, resultadoLabelSalada, resultadoLabelSaladamaionese, resultadoLabelSuco, resultadoLabelVinagrete, resultadoLabelVodka, picanhaBOOL, alcatraBOOL, lombinhoBOOL, contrafileBOOL, maminhaBOOL, linguicaBOOL, coracaoBOOL, queijoBOOL, asaBOOL, coxaBOOL, paodealhoBOOL, arrozBOOL, farofaBOOL, vinagreteBOOL, saladaBOOL, maionesesaladaBOOL, abacaxiassadoBOOL, cebolaBOOL, cervejaBOOL, refriBOOL, aguaBOOL, sucoBOOL, vodkaBOOL, gadoTotal, something, frangoTotal, acompanhamentoTotal, bebidaTotal, resultadoAlcool, areThereBebidas, alcoolTotal;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


-(void)viewDidAppear:(BOOL)animated{

    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320, 1035)];


    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    backButton.frame     = CGRectMake(20, 986, 108, 30);
    [backButton setTitle:@"Voltar" forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(buttonBack:) forControlEvents:UIControlEventTouchUpInside];
    [scroller addSubview:backButton];

    UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    nextButton.frame     = CGRectMake(192, 986, 108, 30);
    [nextButton setTitle:@"Continuar..." forState:UIControlStateNormal];
    [nextButton addTarget:self action:@selector(buttonNext:) forControlEvents:UIControlEventTouchUpInside];
    [scroller addSubview:nextButton];

}

- (void)viewDidLoad
{

    gadoTotal = 0;

    something = 0;

    resultadoGado = resultadoIntHomens * 0.400 + resultadoIntMulheres * 0.355 + resultadoIntCriancas * 0.200;

    resultadoLinguica = resultadoIntHomens * 0.070 + resultadoIntMulheres * 0.050 + resultadoIntCriancas * 0.030;

    resultadoPorco = resultadoIntHomens * 0.060 + resultadoIntMulheres * 0.035 + resultadoIntCriancas * 0.030;

    resultadoFrango = resultadoIntHomens *  0.085 + resultadoIntMulheres * 0.055 + resultadoIntCriancas * 0.042;

    resultadoQueijo = resultadoIntHomens *  0.050 + resultadoIntMulheres * 0.040 + resultadoIntCriancas * 0.020;

    resultadoAcompanhamento = resultadoIntHomens *  0.225 + resultadoIntMulheres * 0.190 + resultadoIntCriancas * 0.100;

    resultadoAbacaxiassado = resultadoIntHomens *  0.040 + resultadoIntMulheres * 0.025 + resultadoIntCriancas * 0.020;

    resultadoCebolaassada = resultadoIntHomens *  0.050 + resultadoIntMulheres * 0.035 + resultadoIntCriancas * 0.020;

    resultadoPaodealho = resultadoIntHomens *  0.070 + resultadoIntMulheres * 0.045 + resultadoIntCriancas * 0.030;

    resultadoAlcool = resultadoIntHomens *  0.600 + resultadoIntMulheres * 0.350 + resultadoIntCriancas * 0.000;

    resultadoBebidas = resultadoIntHomens *  0.500 + resultadoIntMulheres * 0.650 + resultadoIntCriancas * 0.700;



    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction)buttonBack:(id)sender{

    [self performSegueWithIdentifier:@"backtoCalcSegue" sender:self];

}

-(IBAction)buttonNext:(id)sender{

    if (gadoTotal > 0){
        [self performSegueWithIdentifier:@"shoplistSegue" sender:self];
}else { resultadoLabelFome.text = @"Assim as pessoas vão morrer de fome!";}

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"shoplistSegue"]) {

        ShoplistViewController *resultados = [segue destinationViewController];

        resultados.shoplistPicanha = [resultadoLabelPicanha.text floatValue];
        resultados.shoplistAlcatra = [resultadoLabelAlcatra.text floatValue];
        resultados.shoplistMaminha = [resultadoLabelMaminha.text floatValue];
        resultados.shoplistContrafile = [resultadoLabelContrafile.text floatValue];
        resultados.shoplistLombinho = [resultadoLabelLombinho.text floatValue];
        resultados.shoplistLinguica = [resultadoLabelLinguica.text floatValue];
        resultados.shoplistAsa = [resultadoLabelAsa.text floatValue];
        resultados.shoplistCoxa = [resultadoLabelCoxa.text floatValue];
        resultados.shoplistCoracao = [resultadoLabelCoracao.text floatValue];
        resultados.shoplistQueijo = [resultadoLabelQueijo.text floatValue];
        resultados.shoplistPaodealho = [resultadoLabelPaodealho.text floatValue];
        resultados.shoplistArroz = [resultadoLabelArroz.text floatValue];
        resultados.shoplistFarofa = [resultadoLabelFarofa.text floatValue];
        resultados.shoplistVinagrete = [resultadoLabelVinagrete.text floatValue];
        resultados.shoplistMaionese = [resultadoLabelSaladamaionese.text floatValue];
        resultados.shoplistSalada = [resultadoLabelSalada.text floatValue];
        resultados.shoplistAbacaxi = [resultadoLabelAbacaxiassado.text floatValue];
        resultados.shoplistCebola = [resultadoLabelCebola.text floatValue];
        resultados.shoplistAgua = [resultadoLabelAgua.text floatValue];
        resultados.shoplistCerveja = [resultadoLabelCerveja.text floatValue];
        resultados.shoplistRefri = [resultadoLabelRefri.text floatValue];
        resultados.shoplistVodka = [resultadoLabelVodka.text floatValue];
        resultados.shoplistSuco = [resultadoLabelSuco.text floatValue];

    }
}

@end

EDIT:

it was working properly until i deleted the destination view and put it there again cause it had a little problem on interface builder. When I put it there, on the inspector i put the controlling class againg and everything it had before again…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:42:39+00:00Added an answer on June 18, 2026 at 8:42 am

    This is the problem:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    if ([[segue identifier] isEqualToString:@"shoplistSegue"]) {
    
        ShoplistViewController *resultados = [segue destinationViewController];
    
        resultados.shoplistPicanha = [resultadoLabelPicanha.text floatValue];
    

    Either ShoplistViewController doesn’t implement -setShoplistPicanha: / has no @property (readwrite) shopListPicanha
    or your [segue destinationViewController] doesn’t return what you think it does (ie not
    a ShoplistViewController).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I am confused How to use looping for Json response Array in another Array.
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.