問題描述
我有一個 iPhone 應用程序,我需要在其中加載大量圖像(即大約 50 個),它有一個小矩形(略高于縮略圖),每行包含 3 個,一頁有 4 列,我需要水平滾動以加載接下來的 12 張圖像,依此類推.我還需要將其下的頁碼顯示為 1,2 等.
I have an iPhone application in which i need to load a bulk of images (ie around 50),which has a small rect like (little above thumbnail) containing 3 in each row with 4 columns in one page, and i need to scroll horizontally to load the next 12 images and so on. Also i need to show the page number under it as 1,2 etc.
任何人都可以引導我朝著正確的方向在滾動視圖中實現這一點嗎?我真的很亂,如何將圖像視圖添加到這樣的滾動視圖中,而且每個圖像視圖也有自己的按鈕.
Can any body guide me in the right direction to achieve this in a scroll view ?i am really in a mess ,how to add imageview to a scrollview like this ,also each image view has its own buttons also.
推薦答案
使用 UItableview 創建帶有兩個圖像視圖的自定義單元格并將該自定義單元格加載到索引路徑的單元格中,然后創建一個 nsarray 并將圖像名稱傳遞到該數組中,然后將該圖像轉換為數據格式,例如
Use UItableview create custom cell with two imageviews on it and load that custom cell to cell for indexpath then create an nsarray and pass the image names into that array and then convert that image into data format for eg
nsdata *data = [NSdata dataWithcontents of url [array object at index:indexpath.row]];cell.imageview.image = [uiimage imagewithdata:data];為此,您應該知道創建自定義單元格.
nsdata *data = [NSdata dataWithcontents of url [array object at index:indexpath.row]]; cell.imageview.image = [uiimage imagewithdata:data]; for this you should know to create custom cells.
這篇關于如何在 iphone 水平滾動的滾動視圖中加載圖像包?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!