Here is my setup :
Home page, Profile Page, Friends page.
In each page, there is the exact same segmentend button : [Home | Profile | Friends]
When I tap on a segment, a segue is called and the page changed.
So, when i'm in Profile, Profile is already selected, and i can tap on either Home or Friends ; when i do, the new page is loaded, the new segment is selected and i can do it again if I want to.
In the storyboard, i have only 3 pages with a " a ton " of custom segue (i used custom for animation purposes).
In the code, i have this :
(void)moveToPage
{
if ([self.pageSwitch selectedSegmentIndex] == 1)
{
[self performSegueWithIdentifier:@"fromHomeToProfile" sender:self];;
}
if ([self.pageSwitch selectedSegmentIndex] == 2)
{
[self performSegueWithIdentifier:@"fromHomeToFriends" sender:self];;
}
}
- (IBAction)pageSwitchButton:(id)sender {
[self.pageSwitch addTarget:self
action:@selector(moveToPage)
forControlEvents:UIControlEventValueChanged];
}
the names are self explanatory.
My problem is (we're getting to it) : When i tap on a segment, it becomes selected, but nothing happens THE FIRST TIME. If i tap a new segment (that is obviously not the one from the current page), then it works just fine. Basically, the first tap is ignored, then the second one works. So i have to tap a page, and then tap another that isn't the same for it to work.
Any idea? I'm kind of stuck with this unique problem :D