Xpath changing for elements which are not visible

Hi All,

I have a page and it has title and subtitle. The titles have //UIAApplication[1]/UIAWindow[4]/UIACollectionView[1]/UIACollectionCell[]/UIAStaticText[1] and the subtitles have //UIAApplication[1]/UIAWindow[4]/UIACollectionView[1]/UIACollectionCell[]/UIAStaticText[2].

On ios native app, the first 4 elements are visible and the xpath for titles has UIAStaticText[1]. For the other Elements which are not visible, the xpath for titles is changing to UIAStaticText[2] and viceversa. I am not sure why. Is there an alternate solution? Please help.

@Swetha_Reddy : Can you post screenshot?