我正在尝试制作自定义活动指示器并将大小和位置设置为:(x 坐标 280;y 坐标 5;高度 34;宽度 34)我有代码:
UIImage *statusImage = [UIImage imageNamed:@"activity1.png"];
UIImageView *activityImageView = [[UIImageView alloc]
initWithImage:statusImage];
activityImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"activity1.png"],
[UIImage imageNamed:@"activity2.png"],
[UIImage imageNamed:@"activity3.png"],
[UIImage imageNamed:@"activity4.png"],
[UIImage imageNamed:@"activity5.png"],
[UIImage imageNamed:@"activity6.png"],
[UIImage imageNamed:@"activity7.png"],
[UIImage imageNamed:@"activity8.png"],
[UIImage imageNamed:@"activity9.png"],
[UIImage imageNamed:@"activity10.png"],
[UIImage imageNamed:@"activity11.png"],
[UIImage imageNamed:@"activity12.png"],
[UIImage imageNamed:@"activity13.png"],
[UIImage imageNamed:@"activity14.png"],
[UIImage imageNamed:@"activity15.png"],
[UIImage imageNamed:@"activity16.png"],
[UIImage imageNamed:@"activity17.png"],
[UIImage imageNamed:@"activity18.png"],
nil];
activityImageView.animationDuration = 0.8;
[activityImageView startAnimating];
[self.view addSubview:activityImageView];
这使圆圈和理解我需要代码:
activityImageView.frame = CGRectMake(
self.view.frame.size.width/2
-statusImage.size.width/2,
self.view.frame.size.height/1.2
-statusImage.size.width/1.2,
statusImage.size.width,
statusImage.size.height);
虽然我的问题是我不明白如何使用这段代码将坐标和大小设置为我想要的。非常感谢帮助!