UIScrollView кликабельные изображения iPhone - PullRequest
1 голос
/ 10 августа 2010

Я создал UIScrollView в своем приложении - адаптирован из этого примера кода: http://developer.apple.com/iphone/library/samplecode/Scrolling/Introduction/Intro.html

Но я не знаю, как сделать изображения кликабельными

Есть предложения, пожалуйста?

Спасибо!

Ответы [ 2 ]

2 голосов
/ 10 августа 2010

Да ... "Положи их на кнопки UIB"

//get the image to use, however you want
UIImage* image = [product.images objectAtIndex:i];

UIButton* button = [[UIButton alloc] init];

//set the button states you want the image to show up for
[button setImage:image forState:UIControlStateNormal];
[button setImage:image forState:UIControlStateHighlighted];

//create the touch event target, i am calling the 'productImagePressed' method
[button addTarget:self action:@selector(productImagePressed:)
forControlEvents:UIControlEventTouchUpInside];
//i set the tag to the image #, i was looking though an array of them
button.tag = i;
//add the new button w/ the image to your scrollview 
[ImagesScroller addSubview:button];
[button release];
2 голосов
/ 10 августа 2010

Поместите их на кнопки UIB.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...