Я хотел бы знать, как создать всплывающее меню, которое появляется как подменю другого всплывающего меню, когда пользователь нажимает на определенную строку ..?
PopOver содержит список элементов, называемых ингредиентами. Когда пользователь нажимает на конкретный элемент в popOver, другой popOver должен выскользнуть из него вместе с классифицированным списком. Я знаю, как создавать всплывающие окна, но понятия не имею, как их создавать, поскольку я новичок в iPhone и iPad. Спасибо
Я создал, и мое требование выполняется с помощью следующего кода. Но я бы хотел создать всплывающее окно вроде www.opcenterllc.com -> отзывы
Этот код может показаться неэффективным. Но я старался изо всех сил.
- (void) 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.