Skip to content

set image instead of label at tap? #1

@karthisiva

Description

@karthisiva

how to set image instead of label,i tried this but not working.

  • (UIView *)viewPager:(ViewPagerController *)viewPager viewForTabAtIndex:(NSUInteger)index
    {
    // UILabel *label = [UILabel new];
    // label.backgroundColor = [UIColor clearColor];
    // label.font = [UIFont systemFontOfSize:12.0];
    // label.text = [NSString stringWithFormat:@"karthi #%lu", (unsigned long)index];
    // label.textAlignment = NSTextAlignmentCenter;
    // label.textColor = [UIColor blackColor];
    // [label sizeToFit];
    UIImageView *img=[UIImageView new];
    img.frame=CGRectMake(0, 0, 22, 22);
    [img sizeToFit];
    img.image=[UIImage imageNamed:[self.images objectAtIndex:index]];
    [self.titlesLabels insertObject:img atIndex:index];

    return img;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions