IOS SDK внутри панели настроек табличного представления - PullRequest
0 голосов
/ 10 марта 2011

Хорошо, так что в основном это все.Я пытаюсь запрограммировать базовый диспетчер задач, однако в этот момент вы просто выбираете задачу, и она переходит на другую панель для деталей.Как сделать так, чтобы табличное представление внутри было похоже на приложение с собственными настройками?

> #import "RootViewController.h"
> #import "DetailViewController.h" @implementation RootViewController
> @synthesize toolbar; @synthesize
> window;
> 
> #pragma mark -
> #pragma mark View lifecycle
> 
> 
> 
> - (void)viewDidLoad {     theArray = [[NSArray alloc]
> initWithObjects:@"Kill Taylor",@"Stab
> Taylor",@"Pay Jordan",nil];
>   //theArray = [[NSMutableArray alloc]
> init];
>   
> 
>     [super viewDidLoad];
> 
>   addButton = [[UIBarButtonItem alloc]
> initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
> target:self
> action:@selector(addButtonPressed)];
>   self.navigationItem.rightBarButtonItem
> = addButton;  self.navigationItem.leftBarButtonItem
> = self.editButtonItem;    //self.navigationItem.rightBarButtonItem
> = addButton;    // self.navigationItem.rightBarButtonItem
> = addButton;
>     // Uncomment the following line to display an Edit button in the
> navigation bar for this view
> controller.
>     // self.navigationItem.rightBarButtonItem
> = self.editButtonItem; }
> 
> 
> -(void) addButtonPressed {    NSString *selectedAction = @"add";
>   
> 
>   DetailViewController *dvController =
> [[DetailViewController alloc]
> initWithNibName:@"DetailView"
> bundle:[NSBundle mainBundle]];
>   dvController.selectedAction =
> selectedAction;
>   //dvController.selectedTask =
> selectedTask;
>   [self.navigationController
> pushViewController:dvController
> animated:YES];    [dvController
> release];     dvController = nil; }
> 
> 
> - (void)viewWillAppear:(BOOL)animated {
>     [super viewWillAppear:animated];   }
> 
> /*
> - (void)viewDidAppear:(BOOL)animated {
>     [super viewDidAppear:animated]; }
> */ /*
> - (void)viewWillDisappear:(BOOL)animated
> {     [super viewWillDisappear:animated];
> }
> */ /*
> - (void)viewDidDisappear:(BOOL)animated
> {     [super viewDidDisappear:animated];
> }
> */
> 
> /*  // Override to allow orientations
> other than the default portrait
> orientation.
> - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
> {     // Return YES for supported
> orientations.     return
> (interfaceOrientation ==
> UIInterfaceOrientationPortrait); }  */
> 
> 
> 
> // Customize the number of sections in
> the table view.
> - (NSInteger)numberOfSectionsInTableView:(UITableView
> *)tableView {
>     return 1; }
> 
> 
> // Customize the number of rows in the
> table view.
> - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
> {     return [theArray count];
> 
> }
>  
> 
> 
> // Customize the appearance of table
> view cells.
> - (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]
> autorelease];
>     }
>   
>     cell.textLabel.text = [theArray objectAtIndex:indexPath.row];    
>     return cell;   }
> - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
>     if (editing)
>     {
>         // turn on the "add" button when editing
>         //self.navigationItem.rightBarButtonItem
> = addButton;
>     }
>     else
>     {
>         // remove the "add" butto when not editing
>         //self.navigationItem.rightBarButtonItem
> = nil;
>     }
>   
>      [super setEditing:editing animated:animated]; }
> 
> 
> /* // Override to support conditional
> editing of the table view.
> - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath
> *)indexPath {
>     // Return NO if you do not want the specified item to be editable.
>     return YES; }
> */
> 
> 
> /* // Override to support editing the
> table view.
> - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
> forRowAtIndexPath:(NSIndexPath
> *)indexPath {
>     
>     if (editingStyle == UITableViewCellEditingStyleDelete) {
>         // Delete the row from the data source.
>         [tableView deleteRowsAtIndexPaths:[NSArray
> arrayWithObject:indexPath]
> withRowAnimation:UITableViewRowAnimationFade];
>     }   
>     else if (editingStyle == UITableViewCellEditingStyleInsert) {
>         // Create a new instance of the appropriate class, insert it into
> the array, and add a new row to the
> table view.
>     }    }
> */
> 
> 
> /* // Override to support rearranging
> the table view.
> - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath
> *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
> { }
> */
> 
> 
> /* // Override to support conditional
> rearranging of the table view.
> - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath
> *)indexPath {
>     // Return NO if you do not want the item to be re-orderable.
>     return YES; }
> */
> 
> 
> #pragma mark -
> #pragma mark Table view delegate
> 
> - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
> *)indexPath {     NSString *selectedAction = @"details";  NSString *selectedTask = [theArray
> objectAtIndex:indexPath.row];
>   DetailViewController *dvController =
> [[DetailViewController alloc]
> initWithNibName:@"DetailView"
> bundle:[NSBundle mainBundle]];
>   dvController.selectedAction =
> selectedAction;
>   dvController.selectedTask =
> selectedTask;
>   [self.navigationController
> pushViewController:dvController
> animated:YES];    [dvController
> release];     dvController = nil;      }
> 
> 
> #pragma mark -
> #pragma mark Memory management
> 
> - (void)didReceiveMemoryWarning {
>     // Releases the view if it doesn't have a superview.
>     [super didReceiveMemoryWarning];
>     
>     // Relinquish ownership any cached data, images, etc that aren't in use.
> }
> 
> - (void)viewDidUnload {
>     // Relinquish ownership of anything that can be recreated in
> viewDidLoad or on demand.
>     // For example: self.myOutlet = nil; }
> 
> 
> - (void)dealloc {
>     [super dealloc]; }
> 
> 
> @end

Спасибо заранее, - Michael

Ответы [ 2 ]

2 голосов
/ 10 марта 2011

Выберите в конструкторе интерфейса табличное представление. Затем перейдите к свойствам. Там должно быть что-то вроде стиля. Переключите его, и у вас появится таблица сновидений: -)

0 голосов
/ 27 мая 2011

в инспекторе атрибутов табличного представления, стиль: сгруппированный

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...