简体   繁体   中英

How do I build UITableViewGrouped in a Modal View?

I want to build Grouped View in Modal View which is destination state from "+" button on the Navigation bar in main table view.

I have written this code:

-(void)viewDidLoad
{
    //title
    self.title = @"Set";
    //addBtn
    UIBarButtonItem *addBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(toggleEditing)];
    self.navigationItem.rightBarButtonItem = addBtn;
    [addBtn release];
}

-(IBAction)toggleEditing
{

}
  1. create a subclass of UITableViewController named MyTableViewController

    在此处输入图片说明

  2. use presentModalViewController:animated: in your current viewController

     -(IBAction)toggleEditing { MyTableViewController *tableViewController = [[[MyTableViewController alloc] initWithStyle:UITableViewStyleGrouped] autorelease]; [self presentModalViewController:tableViewController animated:YES]; } 

And you will need a delegate method that tells the viewController from where you showed the modal viewcontroller that a row was selected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM