Created
February 26, 2013 04:26
-
-
Save romyilano/5035868 to your computer and use it in GitHub Desktop.
Creating a UILabel without nib files in a custom uITableViewCell... apress.com pro iOS table views
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
| -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| static NSString *cellIdentifier = @"cellIdentifier"; | |
| UITableVIewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
| if(cell == nil) { | |
| cell = [[UITableVIewCell alloc] initWithStyle:UITableVIewCellStyleDefault resuseIdentifier:cellIdentifier]; | |
| // create a new label with the size we need | |
| UILabel *myLabel = [[UILabel alloc] init]; | |
| myLabel.frame = CGRectMake(75, 10, 200, 25); | |
| // set the label's tag value | |
| myLabel.tag = 1020; | |
| // add the new label to the content view | |
| [cell.contentView addSubView:myLabel]; | |
| } | |
| // configure the cell & custom content here | |
| // | |
| return cell; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment