Created
July 26, 2012 19:15
-
-
Save thiagoricieri/3183911 to your computer and use it in GitHub Desktop.
Implementação de um View Controller com UITableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // MyViewController.m | |
| // Projeto | |
| // | |
| // Created by Thiago Ricieri on 24/07/12. | |
| // Copyright (c) 2012. All rights reserved. | |
| // | |
| #import "MyViewController.h" | |
| @interface MyViewController () | |
| @end | |
| @implementation MyViewController | |
| @synthesize myTableView; | |
| #pragma mark - UITableView methods | |
| - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| UITableViewCell *cell; | |
| NSString *cellIdentifier = @"Cell"; | |
| cell = [cardTabela dequeueReusableCellWithIdentifier:cellIdentifier]; | |
| if(cell == nil){ | |
| cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; | |
| } | |
| return cell; | |
| } | |
| - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
| } | |
| - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| return 1; | |
| } | |
| - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| return 44.0; | |
| } | |
| - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { | |
| return 1; | |
| } | |
| #pragma mark - View Wake Up methods | |
| - (void)viewDidLoad { | |
| [super viewDidLoad]; | |
| myTableView.delegate = self; | |
| myTableView.dataSource = self; | |
| } | |
| - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | |
| self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
| if (self) { | |
| // Custom initialization | |
| } | |
| return self; | |
| } | |
| - (void)viewDidUnload { | |
| [super viewDidUnload]; | |
| } | |
| - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | |
| return (interfaceOrientation == UIInterfaceOrientationPortrait); | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment