The solution I found that works is to in code remove any existing segments at run time then add them back again. After that the segment control works as expected below is some sample code:
[self.segmentList removeAllSegments];
[self.segmentList insertSegmentWithTitle:NSLocalizedString(@"currenttab", @"") atIndex:0 animated:NO];
[self.segmentList insertSegmentWithTitle:NSLocalizedString(@"alltabs", @"") atIndex:1 animated:NO];
[self.segmentList insertSegmentWithTitle:NSLocalizedString(@"favorites_title", @"") atIndex:2 animated:NO];
Post
Replies
Boosts
Views
Activity
You can recreate this issue by
Creating a new app project in Xcode, I am using Xcode 15.3:
Set the interface to storyboard and the language to objective c
In the default storyboard, add a segment control with 3 segments. In my test project I added 2 segment controls one pined/anchored to the top of the view and the second control with not anchoring to see if it made a difference. No need to wire up any outlets
Run the project using Apple Vision Pro target in the simulator on an actual device.
Select the second or third segment, then select any other segment. That will cause focus to return to the first segment and no other taps/click/pinches will have any effect
My app use objective c not SwiftUI so the segment control is added to a view controller in interface builder and pinned to the top of the view controller with padding. The only code sets the title of the segments, sets the selected segment and listens to the value changed event.
To debug if it was a code issue or maybe to see if I wired the control incorrectly, I added another segment control to the view in interface builder with 3 segments but I didn't create an outlet to access the control in code and I didn't link it to any events and I got the same behavior.
I filed bug report 13678160 in the feedback assistant with a video attached, can you see this.
The say a picture is worth a thousand words
Step 1: the view loads with first tab selected by default:
Steps 2: select segment #2, I get the value did change event with selectedSegmentIndex is 1 and segment #2 gets highlighted
Step 3: select segment #3, I get the value did change even but selectedSegmentIndex is 0, the first segment gets highlighted but segment #3 should be highlighted
Step 4: If select any segment 1, 2 or 3 then no value changed event is triggered and focus remains on segment #1
Said another way, after selecting a second segment, the control returns focus to segment #1 and seems to be non responsive.
Hopefully the pictures and words paint a clearer picture.
I submitted a Technical Support Incident on 7/1/2020 with screenshots and everything including the pkg file that that the export archive button created but I have not heard anything from that. Also, I tried what you suggested to launch xcode from Terminal but it did not work. Below is what I tried:
When I execute "xcode-select -p/../MacOS/Xcode" in the terminal I get:
xcode-select: error: invalid argument '-p/../MacOS/Xcode'
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
When I execute "xcode-select -p" in the terminal I get:
/Applications/Xcode11.5.app/Contents/Developer
When I execute "/Applications/Xcode11.5.app" in the terminal I get:
zsh: permission denied: /Applications/Xcode11.5.app
Did I miss something?