I have a simple project to present a modal view controller and pass back the string based on which a button was pressed in modal VC. I based all this on viewing the Stanford class on iTunes U. It seems that I have everything right, but I get a couple of compiler warnings.
First, I get one called passing argument 1 of 'setDelegate:' from incompatible pointer type in TransferViewController.m
Second, I get four warnings called Invalid receiver type 'id <MyModalViewControllerDelegate>*' , but they do not appear in the assembly results area, but next to offensive lines in MyModalViewController.m , both lines in each of the button actions.
Here is the code ...
// TransferViewController.h #import <UIKit/UIKit.h>
// TransferViewController.m
// MyModalViewController.h #import <UIKit/UIKit.h> @protocol MyModalViewControllerDelegate; @interface MyModalViewController : UIViewController { UIButton *abby; UIButton *zion; id <MyModalViewControllerDelegate> delegate; } @property (assign) id <MyModalViewControllerDelegate> delegate; - (IBAction)selectedAbby; - (IBAction)selectedZion; @end @protocol MyModalViewControllerDelegate <NSObject> @optional - (void)myModalViewController:(MyModalViewController *)controller didFinishSelecting:(NSString *)selectedDog; @end
// MyModalViewController.m
Steve source share