I'm using an iCarousel where i display some buttons. But how do I get to another view when the button is tapped?
I have this code already:
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return 10;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
UIButton *button = (UIButton *)view;
if (button == nil)
{
UIImage *image = [UIImage imageNamed:@"page.png"];
button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height);
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setBackgroundImage:image forState:UIControlStateNormal];
button.titleLabel.font = [button.titleLabel.font fontWithSize:50];
[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
}
return button;
}
- (void)buttonTapped:(UIButton *)sender
{
NSInteger index = [carousel indexOfItemViewOrSubview:sender];
//Action
}
How do I get to another view when the button is tapped? Can I use the prepareForSegue method here as well?
Thanks for your help!!