动画IOS开机画面

时间:2019-04-06 13:21:30

标签: objective-c

我正在尝试让我的启动屏幕依次显示3张图像。

我已经尝试了多种方法,但是如果有人在这里看到我的代码做错了什么,就会遇到错误?

print (df1)
   user_id  age  height  item_id  item_height
0        1   11      15        3            4
1        1   11      15        5            4

错误

@interface CydiaLoadingViewController : UIViewController
@end

%hook CydiaLoadingViewController
-(void)loadView {
%orig;
UIView *xiView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
xiView.backgroundColor = [UIColor whiteColor];
UIImage *image1 = [UIImage imageNamed:@"image1.png"];
UIImage *image2 = [UIImage imageNamed:@"image2.png"];
UIImage *image3 = [UIImage imageNamed:@"image3.png"];
UIImageView *logo =[[NSArray alloc] initWithObjects:image1,image2,image3, nil];
logo.imageView.animationRepeatCount = 7;
[logo.imageView startAnimating];
logo.frame = CGRectMake([UIScreen mainScreen].bounds.size.width / 2 - 60, [UIScreen mainScreen].bounds.size.height / 2 - 90, 120, 120);
logo.layer.masksToBounds = YES;
logo.layer.cornerRadius = 10;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height / 2 + 60, [UIScreen mainScreen].bounds.size.width, 40)];
label.text = @"Cydia";
label.textAlignment = NSTextAlignmentCenter;
[label setFont:[UIFont boldSystemFontOfSize:30]];\
[xiView addSubview:logo];
[xiView addSubview:label];
[[self view] addSubview:xiView];
}

-(BOOL)hidesNavigationBar {
    return YES;
}
%end

1 个答案:

答案 0 :(得分:1)

错误是因为您在此行将NSArray的实例分配给了UIImageView变量。

UIImageView *logo =[[NSArray alloc] initWithObjects:image1,image2,image3, nil];

据我了解,您想使用UIImageView来一张一张地展示这3张图片。在这种情况下,您应该正常创建UIImageView并使用UIImageView's animationImages property

例如

UIImageView *logo = [[UIImageView alloc] init];
logo.animationImages = [[NSArray alloc] initWithObjects:image1,image2,image3, nil];