效果图:
工程图:
需要导入的文件包是BGMovingComponent.
代码:
#import "RootViewController.h" //加入头文件 #import "BGMovingComponent.h" - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"浮动的云"; BGMovingComponent *cloud = [[BGMovingComponent alloc] initWithFrame:CGRectMake(0, 0, 320, 60)]; [self.view addSubview:cloud]; }