After Install (From Mobile)
At first install Root Browser.
1. Run Root Browser and Go to the system folder.
2. There you will see a file name build.prop
6. Now press Save Button. Go back and reboot your phone.
Before Install Custom Rom (From PC)
1. Go to your Custom Rom's system folder
2. Open build.prop file with Notepad++
3. Search the line ro.sf.hwrotation=0 and make it ro.sf.hwrotation=180
4. Save the file.
Now you will not face the problem of screen rotation (reversed) after install.