This step by step to block ads is based on my experience to my iPhone 4S on IOS 7.0.4.
1. You must jailbreak your iDevice with evasion
2. After jailbreak is finished, on cydia install openSSH, and change default password for necessary
3. There’s so much ssh client but I use Cyberduck to touch hosts file on iPhone at /etc/
4. open http://someonewhocares.org/hosts/zero/ and copy all to hosts file, which all this setting the hosts file will block all ads which so much disturbing when you browsing on safari or when you open an application.