2011-12-22 13 views
0

enter image description here想擁有視圖使用的UITableView

在我的應用程序附加的圖片,我有一個要求,使該網格view..type ....我想的UITableView做...(雖然通過滾動視圖)

我的查詢,通過使用自定義單元格,在1行完成,將有在它4圖像視圖1個自定義單元格...

所以現在對圖像攻我怎麼知道單元格內的哪個圖像被點擊?

或第二個選項我thought..as每個圖像定製cell..but不知道如何着手furthur ....如何才能在1行獲得2個相鄰小區????

也想知道哪種方法比較好...這將在包含50張圖片左右....和攻絲更大視圖與滾動打開這個網格視圖...

感謝

回答

0

你什麼可以做的是創建了UIView內自定義的UIButton並設置背景圖像和選擇。

事情是這樣的:

UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(0, 0, 24, 24)]; 

[button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 

[button setBackgroundImage:[UIImage imageNamed:@"someImage.png"] forState:UIControlStateNormal]; 

[buttonHolder addSubview:button]; //buttonHolder will be one of the UIView in your cell 
0

我已創建的圖片庫視圖中使用滾動視圖gallery view

如果你想在表視圖,使你必須創建4圖像視圖和一個自定義單元格按鈕每個圖像附有圖片的標籤時,按下按鈕就得到了標籤號,你可以找到哪個圖像按鈕被點擊。