如何在objective-c中创建和定位新的imageview?
谢谢!
我试过这个,但它似乎没有做任何事情......
-(void)drawStars{ //uses random numbers to display a star on screen
//create random position
int xCoordinate = arc4random() % 10;
int yCoordinate = arc4random() % 10;
UIImageView *starImgView = [[UIImageView alloc] initWithFrame:CGRectMake(xCoordinate, yCoordinate, 58, 40)]; //create ImageView
starImgView.image = [UIImage imageNamed:@"star.png"];
[starImgView release];
Run Code Online (Sandbox Code Playgroud)
我把这个方法放在我的viewcontroller中.我看到一些CG东西我需要导入核心图形或其他什么?(无论如何,核心图形是什么?)
cocoa-touch ×1