Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
- if (cell==nil) {
- cell=[[UITableViewCell alloc]init];
- }
- if([indexPath row] == 0){
- cell.textLabel.text=@"mano";
- cell.backgroundColor = [UIColor redColor];
- }
- if([indexPath row] == 1){
- cell.textLabel.text=@"happy";
- cell.backgroundColor=[UIColor whiteColor];
- }
- if([indexPath row] == 2){
- cell.textLabel.text=@"welcome";
- cell.backgroundColor=[UIColor grayColor];
- }
- if([indexPath row] == 3)
- {
- cell.textLabel.text=@"enjoy";
- cell.backgroundColor=[UIColor magentaColor];
- }
- return cell;
- }
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
- NSString *file = [[NSBundle mainBundle] pathForResource:[self.photos objectAtIndex:self.currentIndex] ofType:nil];
- cell.imageView.image = [UIImage imageWithContentsOfFile:file]
- cell.imageView.image = [UIImage imageNamed:@"imageName.png"];
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
- if (cell==nil) {
- cell=[[UITableViewCell alloc]init];
- }
- if([indexPath row] == 0){
- cell.textLabel.text=@"mano";
- cell.backgroundColor = [UIColor redColor];
- cell.imageView.image = [UIImage imageNamed:@"arrow0.png"];
- }
- if([indexPath row] == 1){
- cell.textLabel.text=@"happy";
- cell.backgroundColor=[UIColor whiteColor];
- cell.imageView.image = [UIImage imageNamed:@"arrow1.png"];
- }
- if([indexPath row] == 2){
- cell.textLabel.text=@"welcome";
- cell.backgroundColor=[UIColor grayColor];
- cell.imageView.image = [UIImage imageNamed:@"arrow2.png"];
- }
- if([indexPath row] == 3)
- {
- cell.textLabel.text=@"enjoy";
- cell.backgroundColor=[UIColor magentaColor];
- cell.imageView.image = [UIImage imageNamed:@"arrow3.png"];
- }
- return cell;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyIdentifier"];
- }
- cell.imageView.image = [UIImage imageNamed:@"image.png"];
- cell.backgroundColor=[UIColor magentaColor];
- return cell;
- }
- If you have used storyboard then no need to check if cell is nil. It intializes cell automatically when dequeing is not possible. Please check this tutorial.
- cell.accessoryView = UIImageView(image:UIImage(named:"imageNmae")!)
Add Comment
Please, Sign In to add comment