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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:46:27+00:00 2026-05-27T03:46:27+00:00

I try to implement User define Delegate.For that i did this code **- DelegateAppDelegate.h**

  • 0

I try to implement User define Delegate.For that i did this code

**- DelegateAppDelegate.h**
#import <UIKit/UIKit.h>
#import "viewApp.h"
@interface DelegateAppDelegate : NSObject <UIApplicationDelegate,SampleDeledate> 
{

}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@end

 **- DelegateAppDelegate.h**

#import "DelegateAppDelegate.h"

@implementation DelegateAppDelegate


@synthesize window=_window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    viewApp *v=[[view alloc]initWithNibName:@"viewApp" bundle:nil];
    [_window addSubview:v.view];   
    return YES;
}


- (void)dealloc
{
    [_window release];
    [super dealloc];
}
@end

@implementation DelegateAppDelegate(SampleDeledate)

-(void)AppImageDidLoad:(NSString*)Name;
{
    NSLog(@"hi........%@",Name);
}
@end
 **- viewApp.h**
#import <UIKit/UIKit.h>
@class viewApp;


@protocol SampleDeledate;

@protocol SampleDeledate <NSObject>
    @required
        -(void)AppImageDidLoad:(NSString*)Name;
@end

@interface viewApp : UIViewController 
{
    id<SampleDeledate>delegate;
}

@property(nonatomic,assign)id<SampleDeledate>delegate;

-(IBAction)DelegateFunction:(id)sender;
@end

 **- viewApp.m**

#import "viewApp.h"

@implementation view
@synthesize delegate;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {  }
    return self;
}
- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
      [super didReceiveMemoryWarning];    
}
- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}
-(IBAction)DelegateFunction:(id)sender
{


  [self.delegate AppImageDidLoad:@"Delegate sample"];

}
@end

In this coding my intention is When i click button, Corresponding Action get executed( -(IBAction)DelegateFunction:(id)sender),then i want to call the AppImageDidLoad delegate method, But in my coding this is not working,
1)Why this is not working,Any wrong i did?
thanks for your replay

  • 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-27T03:46:28+00:00Added an answer on May 27, 2026 at 3:46 am

    In the following method

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    
        viewApp *v=[[view alloc]initWithNibName:@"viewApp" bundle:nil];
        [_window addSubview:v.view];   
        return YES;
    }
    

    add one more line and make it as follows.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        viewApp *v=[[view alloc]initWithNibName:@"viewApp" bundle:nil];
        v.delegate = self;
        [_window addSubview:v.view];   
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I try to implement my class on this file I get an error
If I try to implement this simple-as-possible example: Update Content with AJAXRefreshRequest it does
I try to implement the following code: <div class=clearid=usernameline>username:<input type=text name=username id=username style=border:1px solid
i'm trying to implement paging in xml using this code and got around to
hi we try to implement a process like when a user does something, his
I'm try to implement a user search on top of my working Smack-API based
I've try to implement integration tests for a working application (spring, hibernate, soap, cxf).
I had try to implement the send me log feature into my apps but
I would like to implement an B+ tree in Java and try to optimize
My first try of MVC. Am trying to implement a simple example. Inspiration from

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.