adapt to ios6 and ios7