所以我对 Objective C 很新,只是想做一个调整!代码在 Xcode 上运行良好,但我想改变它以便它可以作为越狱调整。基本上当你在家里屏幕/跳板时,你只需点击并按住屏幕一秒钟,然后给你一个带有3个按钮的UIAlertView
。我只是想知道如何在跳板上翻译它!我应该使用哪个头文件!
这是我在 Xcode 上使用的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)];
self.lpgr.minimumPressDuration = 1.0f;
self.lpgr.allowableMovement = 100.0f;
[self.view addGestureRecognizer:self.lpgr];
}
- (void)handleLongPressGestures:(UILongPressGestureRecognizer *)sender
{
if ([sender isEqual:self.lpgr])
{
if (sender.state == UIGestureRecognizerStateBegan)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Gestures" message:@"Long Gesture Detected" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Message", @"Facetime", @"Phone", nil];
[alertView show];
}
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1)
{
NSLog(@"Message");
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:+1234567890"]];
}
if (buttonIndex == 2)
{
NSLog(@"Facetime");
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"facetime://tel-number"]];
}
if (buttonIndex == 3)
{
NSLog(@"Phone");
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:%@"]];
}
}