want to go to next view from rightbarbutton item.

Posted by uttam on Stack Overflow See other posts from Stack Overflow or by uttam
Published on 2009-12-11T12:35:24Z Indexed on 2010/04/21 9:03 UTC
Read the original article Hit count: 226

Filed under:
|

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;
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk