want to go to next view from rightbarbutton item.
- by uttam
I am using this code to get the three button on the right side of the navigationbar ,button are visible but next to this I want to go to the next view from this three button image, text ,vedio.
NSArray *segmentTextContent = [NSArray arrayWithObjects:@"Image",@"Text",@"Video",nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentTextContent];
segmentedControl.frame = CGRectMake(13, 20, 150, kCustomButtonHeight);
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.momentary = YES;
defaultTintColor = [segmentedControl.tintColor retain]; // keep track of this for later
UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
self.navigationItem.rightBarButtonItem = segmentBarItem;
if(segmentedControl.selectedSegmentIndex=0)
{
[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
}
else if(segmentedControl.selectedSegmentIndex==1)
{
[segmentedControl addTarget:self action:@selector(segmentAction1:) forControlEvents:UIControlEventValueChanged];
}
else if(segmentedControl.selectedSegmentIndex==2)
{
[segmentedControl addTarget:self action:@selector(segmentAction2:) forControlEvents:UIControlEventValueChanged];
}
[segmentBarItem release];
//[modalBarButtonItem release];
}
return self;
}