How to get a color image in iPhone sdk

后端 未结 2 1209
情深已故
情深已故 2020-12-10 07:29

I want something as follows

UIImage *solid = [UIImage imageWithColor:[UIColor darkGrayColor]];

to create an image with respect to some colo

2条回答
  •  不知归路
    2020-12-10 07:45

    If you're just trying to create a solid rectangle of colour why not just do something like

    UIView *solid = [[UIView alloc] initWithFrame:someFrame];
    solid.backgroundColor = [UIColor greyColor];
    

    And then add the view to whatever subview you want to show the solid colour.

    (That is, of course only if that's what you're trying to achieve. Maybe you aren't)

提交回复
热议问题