我已经下载从GitHub的UIPopOverListView,在我的工作区粘贴,然后单击,出现popoverlistview,而是一个按钮时,代表和数据源的方法被调用,但不能正常工作,
当点击我的按钮委托和数据源不适用于iOS中的UIPopoverListView?
-(void) effectsButtonClicked
{
effectsPopView = [[UIPopoverListView alloc] initWithFrame:CGRectMake(10,150,300,200)];
effectsPopView.delegate=self;
effectsPopView.datasource=self;
effectsPopView.listView.scrollEnabled = FALSE;
[effectsPopView setTitle:@"Effects"];
[effectsPopView show];
}
然后我datasouce和代表们
#pragma mark - UIPopOverListView DataSource
- (NSInteger)popoverListView:(UIPopoverListView *)popoverListView
numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)popoverListView:(UIPopoverListView *)popoverListView
cellForIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
UITableViewCell * effectsCell= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:identifier];
effectsArray=[NSArray arrayWithObjects:@"Black and White",@"Sepia",@"Hue",@"Snow",@"Normal", nil];
effectsCell.textLabel.text=[effectsArray objectAtIndex:indexPath.row];
effectsCell.textLabel.textColor=[UIColor redColor];
NSLog(@"%@",effectsArray);
return effectsCell;
}
#pragma mark- UIPopoverList Delegates
- (void)popoverListView:(UIPopoverListView *)popoverListView
didSelectIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"ROw selected");
}
屏幕截图
任何人都可以解释,为什么数据源和代表不工作