I've got a really annoying issue at the moment while trying to create an overlay to provide a greyed out interface when searching and then when it's touched dismiss it.
I've adapted some code from another part of my app and to me they are completely the same, expect the variable name changes etc.
Here's the two header files for comparison
Contacts search overlay:
#import <UIKit/UIKit.h>
@class Contacts;
@interface Overlay : UIViewController{
Contacts *Contact;
}
@property(nonatomic,retain) Contacts *Contact;
@end
Map search overlay:
#import <UIKit/UIKit.h>
@class Map;
@interface mapOverlay : UIViewController{
Map *searcher;
}
@property(nonatomic,retain) Map *searcher;
@end
And the two method files for comparison
Contacts search overlay:
#import "Overlay.h"
#import "Contacts.h"
@implementation Overlay
@synthesize Contact;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[Contact doneSearching_Clicked:nil];
}
- (void)dealloc {
[Contact release];
[super dealloc];
}
@end
Map search overlay:
#import "mapOverlay.h"
#import "Map.h"
@implementation mapOverlay
@synthesize searcher;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[searcher doneSearching_Clicked:nil];
}
- (void)dealloc {
[searcher release];
[super dealloc];
}
@end
So both of them are exactly the same, and are calling the same function.
Here's the headers for the Contacts and Map classes
Contacts
#import <UIKit/UIKit.h>
@class Overlay;
@interface Contacts : UIViewController <NSXMLParserDelegate , UISearchBarDelegate>{
Overlay *searchOverlay;
}
- (void)doneSearching_Clicked:(id)sender;
@end
Map
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@protocol ModalViewDelegate
- (void)didReceiveMessage:(NSString *)message fromwho:(NSInteger )whichText;
@end
@class mapOverlay;
@interface Map : UIViewController<MKMapViewDelegate,NSXMLParserDelegate, ModalViewDelegate> {
mapOverlay *searchOverlay;
}
- (void)doneSearching_Clicked:(id)sender;
@end
I'm really stumped with this. I'm pretty sure that I've done nothing wrong as both implementations are exactly the same. The only difference is that the Map class has a delegate for a modalview. I've taken this out and tried but still no luck.
I've checked to make sure that both views are registering the touches which they are. It just appears that the overlay used for the map is not sending the message to the Map class.
Does anyone have an idea what could be causing it work in one but not the other?