UIImageView 显示图片和画一条直线

时间:2022-01-12 07:21:42

 
    //创建图片视图
    UIImageView *img1=[[UIImageView  alloc]initWithFrame:CGRectMake(floatcount, 12, 16, 16)];
    //设置图片
    img1.image=[UIImage imageNamed:@"homepic"]; //homepic.png
    [_scrollView addSubview:img1];


UIImageView画一条直线


UIImageView *imgLine=[[UIImageView  alloc]initWithFrame:CGRectMake(floatcount, 32, self.view.frame.size.width-floatcount*2, 1)];
    imgLine.backgroundColor=[UIColor colorWithRed:223/255.0f green:223/255.0f blue:223/255.0f alpha:1.0];
     [_scrollView addSubview:imgLine];