Ios UIPopoverController can';不能处理ui元素
我就是这样展示我的府绸的Ios UIPopoverController can';不能处理ui元素,ios,uipopovercontroller,Ios,Uipopovercontroller,我就是这样展示我的府绸的 - (IBAction)openImage:(id)sender { OptionViewController *option = [[OptionViewController alloc] init]; option.delegate = self; if (!popoverController) { popoverController = [[UIPopoverController allo
- (IBAction)openImage:(id)sender {
OptionViewController *option = [[OptionViewController alloc] init];
option.delegate = self;
if (!popoverController) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:option];
}
popoverController.delegate = self;
[popoverController setPopoverContentSize:CGSizeMake(320, 88)];
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
有一个选项视图控制器
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
}
NSInteger section = [indexPath row];
switch (section) {
case 0: // First cell in section 0
cell.textLabel.text = @"From library";
break;
case 1: // Second cell in section 1
cell.textLabel.text = @"Make a photo";
break;
default:
// Do something else here if a cell other than 1,2,3 or 4 is requested
break;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// I set breakpoints there. For now it doesn't work.
}
OptionViewController是一个UITableViewController(继承),它包含UITableView和委托以及datasource=self(对于OptionViewController实例)
我也在使用XIB。在XIB UITableView中,每侧(左、上、右、下)的自动调整遮罩大小设置
在其他方法中,我不会调用任何其他可以锁定视图或其他操作的方法
有一个带有颜色屏幕外渲染选项的屏幕截图
我认为您错误地设置了OptionViewController的委托。 如果委托方法的实现在OptionViewController中,则应删除设置option.delegate或将其设置为自身:
option.delegate=option代码>
您的数据源委托(option.dataSource)看起来正在工作,但委托(option.delegate)没有工作。您所说的“我不能处理任何UI控件”是什么意思?例如,如果我点击按钮,它们就不工作了。或者当我点击表格中的单元格时。对我有什么反应。就好像我设置用户交互已启用=false或设置已启用:当点击表中的单元格时(从PrintViewController
类),是否可以发布期望执行的代码?您还可以提供有关视图设置的更多信息吗?您使用的是XIB还是故事板?你有合适的插座连接吗?当然我已经更新了我的帖子。谢谢如果我错了,那么请指定代码的每个部分在哪些文件/类中。