Heterostructured TiO2/MgO nanowire arrays for self-powered UV photodetectors