This time we will change the action when you press the power button. We will just show a little frame with a custom message.
To begin, you have to create a new tweak project with Theos (instructions in the first post). In this tutorial I put the name PowerInject, but like in the others posts, you can choose the name you want. When you have made this, you can go into iFile and go in the directory of your tweak.
Now open the “Tweak.xm” file. Delete all the text that is in it and copy the following code into this :
UIAlertView *powerinjectAlert = [[UIAlertView alloc] initWithTitle:@"PowerInject" message:@"You can't power off your iDevice with this method"
otherButtonTitles:@"Awwwww :"(", nil];
Go back into the Terminal and compile the tweak. Now when you want to turn off your iDevice with the power button, you can’t and you’ll have a beautiful message 🙂 .
The original code and idea of this tweak are from ReverseEffect.