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

The Archive Base Latest Questions

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

I have application where i have two view controllers my first view and second

  • 0

I have application where i have two view controllers my first view and second view controller is in uipopovercontroller. i want value of second view controller in first view for that i have created protocol. here is my code.
#import
#import “SearchPopoverController.h”
#import “AppDelegate.h”

@interface ViewController : UIViewController<PassSearchValueDelegate>{
AppDelegate *appDelegate;

SearchPopoverController *popSearch;

IBOutlet UILabel *lblAdd;
}

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


#import "ViewController.h"

// my ViewController.m file code

-(void) getLocationList:(NSString *)strSearch{
lblAdd.text = strSearch;
}
-(IBAction)showpop:(id)sender{
if(![appDelegate.delObjSearchPopoverCon isPopoverVisible]){
    SearchPopoverController *popser = [[SearchPopoverController alloc] init];
    popSearch = popser;
    [popSearch setDelegate:self];

    appDelegate.delObjSearchPopoverCon = [[UIPopoverController alloc] initWithContentViewController:popSearch] ;

    [appDelegate.delObjSearchPopoverCon setPopoverContentSize:CGSizeMake(400 , 150)];
    [appDelegate.delObjSearchPopoverCon presentPopoverFromRect:CGRectMake(0, 0, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


}

}

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

@protocol PassSearchValueDelegate 
@required
-(void) getLocationList:(NSString *)strSearch;
@end
@interface SearchPopoverController : UIViewController <UITextFieldDelegate>{
AppDelegate *appDelegate;
IBOutlet UITextField *txtSearchAdd;
IBOutlet UILabel *lblSearchAdd;

id<PassSearchValueDelegate> _delegate;
}
@property (retain) id _delegate;
@end


//  my SearchPopoverController.m file code

-(IBAction)btnDoneSearch_clicked:(id)sender{

NSString *strAdd = [txtSearchAdd.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
strAdd = [strAdd stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[appDelegate.delObjSearchPopoverCon dismissPopoverAnimated:YES];

if (strAdd != nil || strAdd.length != 0) {
    [_delegate getLocationList:strAdd];
}
}

i am getting warning at this line.

[popSearch setDelegate:self];

and app getting crashed very next line.

Please help me for this. Any help will be appreciated.

  • 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-06T08:28:21+00:00Added an answer on June 6, 2026 at 8:28 am
    id<PassSearchValueDelegate> _delegate;
    // ...
    @property (retain) id _delegate;
    

    Your property should be named just delegate and maybe synthesized to use the _delegate instance variable. You should also specify the protocol on the property type.

    Additionally, delegates should be assign (or weak under ARC) properties.

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

Sidebar

Related Questions

I have two view controller classes in my application delegate. I can change from
I have an application that has two threads. The first one (the main thread)
In my application I have View that observes Model changes. Controller is responsible for
So I have two view controller that I load on the app delegate when
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I have created a tabbarcontroller (with its default two view controllers) using interface builder
I have a Navigation Controller with two Views. The First View is a ViewController
I have a small problem with UINavigationController animation between two view. My application build
In an MVC3 application I have a view rendering two Ajax partial views: a
hai all, in my iphone application i have a login view with two 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.