我搜索了一些教程添加UIImage按鈕的點擊事件。如何URL路徑添加添加URL圖片按鈕點擊
圖像button..For示例代碼:
UIButton *imageView=[[UIButton alloc]initWithFrame:CGRectMake((320*index)+countFlag*80+ 2, 5, 75, 75)];
imageView.tag=i+1;
[imageView addTarget:self action:@selector(imageViewClicked:) forControlEvents:UIControlEventTouchUpInside];
[imageView.layer setBorderColor:[UIColor lightGrayColor].CGColor];
[imageView.layer setBorderWidth:1.0f];
switch ((i+1)%5) {
case 0:
[imageView setImage:[UIImage imageNamed:@"img1.png"] forState:UIControlStateNormal];
break;
case 1:
[imageView setImage:[UIImage imageNamed:@"img2.png"] forState:UIControlStateNormal];
break;
}
你想顯示帶背景圖像的按鈕? – Balu 2013-03-21 11:56:14
使用EGOButton作爲URL。 – 2013-03-21 11:59:08