I'm getting a compiler error when i try to build the following code. Its a simple View (UntitledViewController) that has a navbar with a bar button item which calls showPopUp that creates and displays a pop up with my other view (popoverview).
Popoverview has a button which calls hidePopOver which im trying to make close the pop up , but I'm getting this compiler error:
"expected ':' before '.' token"
on this line:
[UntitledViewController.popOver dismissPopoverAnimated:YES];
If i comment out the line of code or put an NSLog it works fine
UntitledViewController
/*--UntitledViewController.h--*/
#import <UIKit/UIKit.h>
@interface UntitledViewController : UIViewController {
UIPopoverController *popOver;
IBOutlet UIBarButtonItem *popOverbutton;
}
@property (nonatomic, retain) UIPopoverController *popOver;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *popOverbutton;
-(IBAction)showPopUp;
@end
/*--UntitledViewController.m--*/
#import "UntitledViewController.h"
#import "popoverview.h"
@implementation UntitledViewController
@synthesize popOverbutton, popOver;
-(IBAction)showPopUp {
popoverview *popView = [[popoverview alloc] initWithNibName:@"popoverview" bundle:nil];
popOver = [[UIPopoverController alloc] initWithContentViewController:popView];
[popOver presentPopoverFromBarButtonItem:popOverbutton permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
...
popoverview
/*--popoverview.h--*/
#import <UIKit/UIKit.h>
@interface popoverview : UIViewController {
}
-(IBAction)hidePopOver;
@end
/*--popoverview.m--*/
#import "popoverview.h"
#import "UntitledViewController.h"
@implementation popoverview
-(IBAction)hidePopOver {
[UntitledViewController.popOver dismissPopoverAnimated:YES]; (ERROR "expected ':' before '.' token")
}