gpt4 book ai didi

ios - BarButtonItem 与 Popover Controller ?

转载 作者:行者123 更新时间:2023-11-29 04:16:46 27 4
gpt4 key购买 nike

我有一个 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;
}

最佳答案

可能只是一个拼写错误,但当您创建按钮时,选择器应该是 showPop:(带冒号)而不是 showPop。

关于ios - BarButtonItem 与 Popover Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13587317/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com