How can I delegate method from modalView to the parentView

Hi
I've 2 ViewControllers: parent,and child(ModalView)
the parent is named "testDelegationViewController" and the child is "modal"
then I want to send some parameters from the modalView to parentView On dismiss of the child
but it doesn't work. I think that something is missing on my code.
testDelegationViewController.h:
#import <UIKit/UIKit.h>
#import "modal.h";
@interface testDelegationViewController : UIViewController<myDelegate> {
IBOutlet UIButton *btnParent ;
IBOutlet UILabel *lblParent ;
@property (nonatomic, retain) IBOutlet UIButton *btnParent;
@property (nonatomic, retain) IBOutlet UILabel *lblParent;
-(IBAction) parentButtonclicked;
@end
testDelegationViewController.m
#import "testDelegationViewController.h"
#import "modal.h";
@implementation testDelegationViewController
@synthesize btnParent;
@synthesize lblParent;
-(IBAction) parentButtonclicked
self.lblParent.text=@"changed by btnParent";
modal *m = \[\[modal alloc\] initWithNibName:@"modal" bundle:nil\];
\[self presentModalViewController:m animated:YES\];
- (void)modalButtonlicked:(NSString *)subcontroller
NSLog(@"modal Button clicked");// >>>>>>>>>>method not called problem here<<<<<<<<<<<<<<<<<
//NSString *myData = \[subcontroller getData\];
// \[self dimissModalViewControllerAnimated:YES\];
- (void)didReceiveMemoryWarning {
\[super didReceiveMemoryWarning\];
- (void)viewDidUnload {
- (void)dealloc {
\[super dealloc\];
@end
modal.h
#import <UIKit/UIKit.h>
//@protocol myDelegate;
@protocol myDelegate
-(void)modalButtonlicked:(NSString *)subController;
//-(void)clickedButton:(modal *)subController;
@end
@interface modal : UIViewController {
IBOutlet UIButton *btnmodal ;
id<myDelegate> delegate;
NSString *data;
@property (nonatomic, retain) IBOutlet UIButton *btnmodal;
@property (nonatomic, assign) id<myDelegate> delegate;
-(IBAction) returnParent;
-(NSString *)getData;
@end
modal.m
#import "modal.h"
@implementation modal
@synthesize btnmodal;
@synthesize delegate;
-(IBAction) returnParent
NSLog(@"child button clicked");
\[delegate modalButtonlicked:@"change parent label from modal"\];
// \[delegate modalButtonlicked:self\];//the dismiss must be in the parentView
\[super dismissModalViewControllerAnimated:YES\];
- (void)didReceiveMemoryWarning {
\[super didReceiveMemoryWarning\];
- (void)viewDidUnload {
\[super viewDidUnload\];
- (void)dealloc {
\[super dealloc\];
@end
can you help me?
thanks in advance
null

Hi Sculpteur, and wecome to the Dev Forum!
It looks like you never connected the delegate property of the modal view controller to the parent view controller. The easiest way to fix that is to make the connection in code right after the modal controller is created:
-(IBAction) parentButtonclicked
self.lblParent.text=@"changed by btnParent";
modal *m = [[modal alloc] initWithNibName:@"modal" bundle:nil];
m.delegate = self; // <-- make this object the delegate of m
[self presentModalViewController:m animated:YES];
[m release]; // <-- fix memory leak
- Ray

Similar Messages

  • HT201302 Hi People! please help...I want to know how can i get photos from ipad to the computer, that were synchronized previously to ipad but from another pc that i dont have access anymore and these pics are now only found in this ipad and no other plac

    Hi People!
    Please help...I want to know how can i get photos from ipad to the computer, that were synchronized previously to ipad but from another pc that i dont have access anymore and these pics are now only found in this ipad and no other place.

    Hi Alan,
    Thanks for the help, but i've actually done that before.
    It does not help, because it only shows the photos on the camera roll and do not show the photos synchronized with that pc that i dont have access anymore.
    The photos/albums all appear on the ipad, i can see it without problems but i cant get them out of the ipad to save onto pc for backup.
    And i reaaly need it, as it is the only place that i actually have these photos now...

  • How can i stop apps from running in the background with the new ios7 update

    How can i stop apps from running in the background with the new ios7 update

    Double tap the Home button...slide the last used view of the app(above the icon) up. Tap Home button when finished.

  • How can I text message from iPad to the galaxy note 2 phone ?

    How can I text message from iPad to the galaxy note 2 phone ?

    You can only iMessage iDevices.
    You need 3rd party apps to text your Galaxy Note.

  • How can you transfer videos from iphone to the ipad?

    How can you transfer videos from iphone to the ipad?

    Copy Photos Between iOS Devices
    http://tinyurl.com/cnz95bc
     Cheers, Tom

  • How can I transfer files from Apps to the PC in iTunes 11.1.3.8

    How can I transfer files from Apps to thr PA in iTunes 11.1.3.8
    (App :eBooks from Bluefire Reader)

    Connect the device to iTunes.
    Select the Apps tab.
    Select the apps desired to sync.
    Sync.
    iTunes remembers sync settings per device.

  • How can I import images from iphoto with the albums and folders?

    How can I import images from iphoto without losing the albums and folders I already created?

    In Organizer, you can choose File>get Photos and Videos>From iPhoto.
    Importing from iPhoto'09: If in iPhoto, you organize your media using photo references, that is, the media actually does not reside inside iPhoto library package, and are referenced through original locations, Organizer does not create new copies of those media and just refer to the original location. but if your iPhoto media reside inside iPhoto library, Organizer creates a copy all media in your pictures folder, also imports albums and tags and other metadata.
    Importing from iPhoto'011: In this case, Organizer always creates a copy of your photos in your pictures folder which resides inside iPohto package. It does not import the albums and other metadata like star rating, caption etc.
    Hope this information helps!
    regards,
    vaishali

  • "Over capacity": How can I delete photos from iPhone / set the maximum capacity of iCloud photos to be downloaded to iPhone?

    Hi,
    My iPhone regularily goes over capacity because it stores, or tries to store, too many photos/videos from iCloud on the device.
    How can I delete photos from the iPhone (but not generally from iCloud/Photostream). How can set the maximum capacity of iCloud photos to be downloaded to iPhone? (I am searching for a setting like "keep the last 2GB of photos/videos from iCloud/Photostream, but not more than that. I know how to turn iCloud off in total, but that is not what I would prefer to do, I just would like to set reasonable maximum.)
    Thank you for your ideas!
    Generally, I someone could point me to a good tutorial on how local photos vs. iCloud photos vs. Photostream are supposed to work that would be great as well, because I have many other problem with Apple's system in that regard as well (esp., despite that obviously a lot of space is taken up by photos/videos on my device, my iPhone still downloads recent photos/videos over 3G... I also have the problem that all photos appear double if I try to copy to my Mac with ImageCapture or iPhoto, but there is only a single copy (no HDR, burst or the like) when seen with the Photos.app of the iPhone itself... I came to believe that Apple's photo system is somewhere between counterintuitive and plainly not working... (/rant off) )

    Sorry there are no settings to set max capacity.
    My Photo Stream FAQ - Apple Support
    Get help using My Photo Stream - Apple Support
    iCloud: iCloud storage and backup overview

  • How can I get keys from Hashtable in the same order?

    Hello, everyone.
    I have a Hashtable containing key-value pairs, I need to get the keys in the same order as I use
    method put(key,value) to save the key-value pairs. But I can only find Hashtable.keys() to fetch the keys in form of Enumeration and when retrieve the keys from the Enumeration,they are not in the original order!
    The following is my code:
    Hashtable ht = new Hashtable();
    ht.put("Name","Harry Bott");
    ht.put("Gender","Male");
    ht.put("Age","25");
    String[] Items = new String[ht.size()];
    Enumeration e = ht.keys();
    int i = 0;
    while(e.hasMoreElements()) {
    Items[i++] =(String)(e.nextElement());
    The Items contains the keys but they are not in the original order.
    Does anyone know how to get the keys from a Hashtable in the same order when they're put?
    Thank you!

    yeah, another solution is to stored keys on a Collection at the same time you put them on the HashMap with its values.
    Then when ur going to retrieve objects from the Map u iterate the Collection that has the ordered keys and use them.

  • How can I stop Firefox from putting up the question Do I want to have Firefox as my seach?

    Foxfire asks if I want it be my search every time it starts. How can it be stopped?

    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!

  • How can I prevent apps from syncing in the new iTunes?

    Hey there.
    I brang my macbook to Applestore cause it had a problem and they downloaded the latest version of itunes. Everything's fine and my music, videos and apps are in the new itunes like before. But now, when I want to sync my ipod touch, a pop window asks me to give the password of the itunes account I used to download some of my apps or it will delete them and their data. The problem is that one of these accounts is an old friend's one and I actually lost all contact with him. So basically now I can't sync my iphone at all or it will delete all my apps.
    Has anyone any idea how to sort that out? Or at least knows how to prevent apps from syncing in this new version of itunes?
    Thanks for your help

    Double tap the Home button...slide the last used view of the app(above the icon) up. Tap Home button when finished.

  • How can I transfer files from one pc the the other pc?

    I've purchased another pc recently and want to transfer my items such as my music and film libraries to my new pc. I want to use HomeShare, and have enabled homeshare on the new pc, and verified it with my apple ID. However, I had to delete my other devices that were using the apple ID as I had reached the maximum of 5 devices.
    I cannot find the homeshare icon on either pc now, and my files are not transfered. I have read the how-to guides from apple and have found them of little use (they seem to be instructions for the old version of itunes.)
    If someone could help, i'd be very grateful!

    Welcome to the Apple community Sophie.
    I'm guessin' you are missing the menu bar...
    Check both computers are authorised from the Store menu and that home sharing is turned on from the File menu.

  • Its loading a page before even i type in the right URL. how can i prevent forefox from automatically loading the suggested page before i hit enter?

    when i type in address bar, its great that the url is automatically filled in based on the history of browsing. but i dont want the page to be loading at the same instant. for ex. if i want to type thehindu.com, once i type 't' its taking for granted that i am typing thermopedia.com and completes the url and loads the page at the same time. I appreciate the url suggestion but not the page loading at the same time. this wastes my data usage (Highly inefficient).
    To complicate the problem, when i type the second letter sometimes it gets appended to the already auto completed url and heads to search for the completely messy words in the default search engine.
    Basically the addressbar has become useless and so is firefox usage. I'm completely frustrated and spoiled over an hour fighting the issue. please provide options to control the loading of the page automatically even if the url is automatically filledin.

    Try some basic troubleshooting.
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings, disables most add-ons (extensions and themes).
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu:
    *In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    *In previous Firefox versions, click on the Firefox button at the top left of the Firefox window and click on ''Help'' (or click on ''Help'' in the Menu bar, if you don't have a Firefox button) then click on ''Restart with Add-ons Disabled''.
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".<br>
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • How can I mix calendars from Exchange and the one on iCloud

    I have different calendars on my iPad as a result of having my Outlook Exchange email from the company I woked for synchronized in it. Now, I don't work there anymore but when I turned on iCloud, the only calendar on iCloud is another one but the one I had on Exchange. Help!!!!!!!!!!!

    So what exactly is the problem?

  • How can I open links from mail in the background?

    I receive a lot of digest emails with lots of links. I would like to be able to click all of the links in a given email, have Safari open those pages in the background, and then when I'm done selecting the links I can switch to Safari and read them all. It's a logical workflow for me: click all the links you want to read, THEN go read them.
    But instead, every single time I click on a link it jumps to Safari, so I have to switch back to Mail, click on the next link (which again jumps to Safari), etc. NetNewsWire allows me to open all my links in the background so I can avoid all this switching back and forth--can Mail do the same thing?
    Thanks in advance for any help ...
    --Bill

    You should be able to Command-click on the link in Mail and have it open in the background.
    Mulder

Maybe you are looking for

  • I am unable to install Itunes 10.6 on my windows vista 64. What do I need to do to be able to install?

    How can I install Itunes 10.6 on my windows Vista 64?

  • SQL Query with Distinct and Count is wrong.

    Hello, i have another problem with a query. Here the Data: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production CREATE      TABLE      TABLE_1 (       "ORDER_NR"        VARCHAR2 (12) ,        "PRIORITY"        VARCHAR2 (2) ,  

  • Creative Vision:M Touch pad is

    I just bought the 60 gig vision M and the touch pad is driving me crazy. Is there any way to turn off the tap selection and have it just scroll like the Zen Touch? Also, are there any cases for the 60 gig player because I can't find any?Message Edite

  • Program name for Web page

    Helo Experts, I have a transaction which opens a web page. Its a page with many tabs n tables n drop down menu. Each of which will open a different view. The web page is a development in webdynpro for abap... I tried finding in SE80... for which i lo

  • Iweb hyperlinks

    I'm new to iweb. I'm re-doing my web site that I manually entered HTML coding for. In iweb, I can't figure out to have hyperlinks appear as a different color from the main text, nor can I get it underlined. The links do work, but they are not obvious