Several prominent investors put fresh money to work in Apple during the third quarter even as they sold out of other high-flying tech companies, betting the iPhone maker’s stock would keep rising as strong growth overshadowed rising trade tensions between the United States and China.