Created
April 1, 2015 18:08
-
-
Save codeOfRobin/e8bded64aec15fc206f0 to your computer and use it in GitHub Desktop.
This file contains 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
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
if (section==0) { | |
return 1; | |
} | |
else | |
{ | |
return [self.data count]; | |
} | |
} | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
return 2; | |
} | |
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.section==0) | |
{ | |
return 250; | |
} | |
else | |
{ | |
return 40; | |
} | |
} | |
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cell"]; | |
if (!cell) | |
{ | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; | |
} | |
if (indexPath.section==0) | |
{ | |
cell.backgroundColor=[UIColor clearColor]; | |
[cell.textLabel setText:@""]; | |
} | |
else | |
{ | |
[cell.textLabel setText:[self.data objectAtIndex:indexPath.row]]; | |
[cell setBackgroundColor:[UIColor greenColor]]; | |
[cell.textLabel setText:[self.data objectAtIndex:indexPath.row]]; | |
} | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment