Cocoa Touch - Adding a UIImageView programmatically?

后端 未结 4 1899
小蘑菇
小蘑菇 2020-12-13 15:12

How can I create and position a new imageview in objective-c?

Thanks!

I tried this but it doesnt seem to do anything...

-(void)drawStars{ //u         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 15:42

    You haven't added your view as a subview to another view, meaning it isn't in the view hierarchy.

    Assuming you are doing this in a view controller, it might look something like:

    [self.view addSubview: imgView];
    

提交回复
热议问题