sudo rm -rf
sudo rm -rf

Reputation: 29524

How to access delegate method from another class?

I have a method in my delegate that does this:

-(void)showAddingPersonalDetails; {
personal = [[AddingPersonalDetails alloc] initWithNibName:@"AddingWithPersonalDetails" bundle:nil];
[window addSubview:personal.view];
[window makeKeyAndVisible];
mainscreen.view.hidden = YES;
NSLog(@"Called");
}

I don't want this view initialized until I need it. That's why put in in a method.

The problem is, I can't seem to access this code from another class.

I even tried this:

BitWiseAppDelegate *appDelegate = (BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.showAddingPersonalDetails;

But it doesn't work. Any ideas?

Upvotes: 0

Views: 817

Answers (1)

jfalexvijay
jfalexvijay

Reputation: 3711

try with following code;


BitWiseAppDelegate *appDelegate = (BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate showAddingPersonalDetails];

or


[(BitWiseAppDelegate *)[[UIApplication sharedApplication] delegate] showAddingPersonalDetails];

Upvotes: 5

Related Questions