BarButtonItem と Popovercontroller があります。問題は、ボタンをクリックしたときに誰が何かをポップできるかということです。この時点で持っているコードをいくつか投稿します。
-(void) showPop:(id)sender{ NSLog(@"test");
UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:popover];
[pop setDelegate:self];
[pop presentPopoverFromBarButtonItem:button permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
//self.title = NSLocalizedString(@"Nieuws", @"Nieuws");
/*if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}*/
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_loading = NO;
self.title = @"Agenda";
if (_refreshHeaderView == nil) {
EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.height, self.view.frame.size.width, self.tableView.bounds.size.height)];
view.delegate = self;
[self.tableView addSubview:view];
_refreshHeaderView = view;
}
// update the last update date
self.navigationController.navigationBar.tintColor = [UIColor darkGrayColor];
if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"Bar-bg.png"] forBarMetrics:UIBarMetricsDefault];
}
[_refreshHeaderView refreshLastUpdatedDate];
self.tableView.contentInset = UIEdgeInsetsMake(66.0f, 0.0f, 0.0f, 0.0f);
[_refreshHeaderView egoRefreshScrollViewDidEndDragging: self.tableView];
//[self loadData];
//[popButton addTarget:self action:@selector(showPop:) forControlEvents:UIControlEventTouchUpInside];
button = [[UIBarButtonItem alloc] initWithTitle:@"Filter" style:UIBarButtonItemStyleBordered target:self action:@selector(showPop)];
self.navigationItem.leftBarButtonItem = button;
}