我想知道当用户点击特定行时,如何创建一个popOver菜单作为另一个popOver菜单的子菜单滑入..?
popOver包含一个名为ingredients的Items列表。当用户点击popOver上的特定项目时,另一个popOver应该使用分类列表从中滑动。我知道如何创建popover但我没有线索来创建这样的东西,因为我是iPhone和iPad的新手。 感谢名单
我已创建,我的要求通过以下代码实现。但我想创建像www.opcenterllc.com这样的popover - >推荐
此代码可能效率不高。但我尽可能多地尝试。
- (无效)popOverMenu {
ingrediant=[[NSArray alloc]initWithObjects:@"ingrediant1",@"ingrediant2",@"ingrediant3",@"ingrediant4",@"ingrediant5", nil];
firstViewController=[[UIViewController alloc]init];
firstViewController.contentSizeForViewInPopover=CGSizeMake(300, 400);
navigationController=[[UINavigationController alloc]initWithRootViewController:firstViewController];
popOverController=[[UIPopoverController alloc]initWithContentViewController:navigationController];
tblView=[[UITableView alloc]initWithFrame:CGRectMake(20.0, 10.0, 260, 360) style:UITableViewStylePlain];
tblView.dataSource=self;
tblView.delegate=self;
tblView.autoresizesSubviews=YES;
UILabel *label1=[[UILabel alloc]initWithFrame:CGRectMake(3, 3, 120, 40)];
label1.text=@"Ingredients";
label1.textColor=[UIColor whiteColor];
label1.backgroundColor=[UIColor clearColor];
label1.textAlignment=UITextAlignmentCenter;
UIBarButtonItem *rightbar=[[UIBarButtonItem alloc]initWithCustomView:label1];
UIBarButtonItem *backBarButton=[[UIBarButtonItem alloc]initWithTitle:@"close" style:UIBarButtonItemStylePlain target:self action:@selector(close:)];
firstViewController.navigationItem.leftBarButtonItem=rightbar;
firstViewController.navigationItem.rightBarButtonItem=backBarButton;
[firstViewController.view addSubview:tblView];
[popOverController presentPopoverFromRect:Button.frame inView:scrollView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
并在
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * tblView2 = [tableView cellForRowAtIndexPath:indexPath];
secondViewController.contentSizeForViewInPopover=CGSizeMake(300, 400);
[[secondViewController navigationItem]setTitle:@"Classified"];
UIBarButtonItem *closeButton=[[UIBarButtonItem alloc]initWithTitle:@"close" style:UIBarButtonItemStyleBordered target:self action:nil];
secondViewController.navigationItem.rightBarButtonItem=closeButton;
[secondViewController.view addSubview:tblView2];
[firstViewController.navigationController pushViewController:secondViewController animated:YES];
[tblView2 reloadData];
}
我的应用已启用ARC。