大家好,我一直在尝试开发一个 cydia,它将在 UIImageView 中为图像设置动画,我认为我的代码都很好,但由于某种原因,应用程序每次执行任务时都会崩溃。我已经读过这可能是一次加载太多图像的原因,但我只尝试加载 2 个小 png 图像,所以我认为这不是原因。请让我知道你的想法!
%hook UISaveToCameraRollActivity
-(void)performActivity {
%orig;
NSBundle *bundle = [[NSBundle alloc] initWithPath:kBundlePath];
NSString *imagePath = [bundle pathForResource:@"hand" ofType:@"png"];
NSString *imagePath1 = [bundle pathForResource:@"floppy" ofType:@"png"];
UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]
bounds]];
statusWindow.windowLevel = UIWindowLevelStatusBar;
statusWindow.hidden = NO;
statusWindow.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7];
UIImageView *pic = [[UIImageView alloc] initWithFrame:CGRectMake (0, 0, 69, 69)];
pic.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"hand.png"],
[UIImage imageNamed:@"floppy.png"], nil];
pic.animationDuration = 1.0f;
[pic startAnimating];
pic.animationRepeatCount = 0;
[pic release];
pic.center = statusWindow.center;
pic.image = [UIImage imageWithContentsOfFile:imagePath];
pic.image = [UIImage imageWithContentsOfFile:imagePath1];
[statusWindow addSubview:pic];
[statusWindow makeKeyAndVisible];
}
%end