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 7672211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:14:01+00:00 2026-05-31T16:14:01+00:00

So, I have two classes, class A and class B. From class A, when

  • 0

So, I have two classes, class A and class B. From class A, when a button is pressed, I have an instance of class B initialize and call its method, testMethod. It sets the text of a a UITextField named text and calls NSLog within this method, but it only calls NSLog when it calls the method! I have no idea what I’m doing wrong, here is my code (Assuming both classes are UIViewController subclasses, and an instance called b was defined in the header file:

ClassA.m

-(IBAction)sendData:(id)sender
{
    b = [[ClassB alloc] init];


    [b testMethod];

    [[self navigationController] pushViewController:b animated:YES];
}

ClassB.m (Yes, the UITextField was propertized and synthesized)

-(void) testMethod
{
    [text setText:@"Text"];

    NSLog(@"This is the only thing getting called in this method");
}

EDIT: I fixed the problem. What I did was pass a variable to class B from class A and have it set its text field from there.

  • 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-05-31T16:14:03+00:00Added an answer on May 31, 2026 at 4:14 pm

    Based on the information that you provided: You are using IB and you believe hat within Interface Builder everything is hooked up properly.

    And assuming that the nib file of your ClassB view controller is “ClassB.xib”.

    Instead of

    b = [[ClassB alloc] init];
    

    use

    b = [[ClassB alloc] initWithNibName:@"ClassB.xib" boundle:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two classes, one inherits from the other Class A{ void
I have a bas class called Media with two classes that inherit from it,
I have a MustInherit Parent class with two Child classes which Inherit from the
I have two UITableViewController classes, MainTableController and SubTableController. From AppDelegate class I am calling
I have two classes class A { public string something { get; set; }
I have a two classes: public class Question { public IList<Answer> Answers { get;
I have these two classes public class Person { } public class Company {
Let's say we have these two classes: public class Base { public static int
greetngs, i have two classes: [Serializable] public class FireGridUnit { public GridUnit FireGridLocation {
I have two classes declared like this: class Object1 { protected ulong guid; protected

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.