0
A
回答
3
所以,如果你想有一個4×4格畫面(即是20×20),每個例如,你可以使用一個滾動視圖,並添加的UIImageViews它像
UIScrollView *s= [[UIScrollView alloc] initWithFrame:someFrame]
int position x=10;
int position y=10;
for(int i=1; i<=pictures.count; i++)
{
UIImageView *image= [[UIImageView alloc] initWithFrame:CGRectMake(x,y,20,20)]
image.image=[UIImage imageNamed:..] //initialize the image for the view
[s addSubview:image];
if(i%4==0) //means you need to start a new row
{
y+=20; //you can tweak this to make it look how you like
x=10; //come back to the beggining
}
else
x+=10; //again tweak this to make it "look" right
}
1
我的標準答案:在Three20 project檢查出TTPhotoViewController
:
TTPhotoViewController模仿蘋果的 照片應用程序及其所有輕彈N」 捏的喜悅。您可以提供自己的 「照片來源」,它的作品 類似於 UITableView所使用的數據源。不像蘋果的照片 應用程序,它不侷限於本地存儲 的照片。您的照片可以從網絡加載 ,並且可以逐步加載長列表 照片。
0
工作對我來說更好(丹尼爾的代碼修改):
UIScrollView *s = [[UIScrollView alloc] initWithFrame:someFrame];
int numOfColumns = 4;
int numOfRows = imagesArray.count/numOfColumns+1;
int space = 10;
int width = (s.frame.size.width-(numOfColumns+1)*space)/numOfColumns;
int height = width;
int x = space;
int y = space;
for (int i=1; i<=imagesArray.count; i++) {
UIImageView *image= [[UIImageView alloc] initWithFrame:CGRectMake(x,y,width,height)];
image.image = [UIImage imageWithData:[imagesArray objectAtIndex:i-1]];
[s addSubview:image];
[image release];
if (i%numOfColumns == 0) {
y += space+height;
x = space;
} else {
x+=space+width;
}
}
int contentWidth = numOfColumns*(space+width)+space;
int contentHeight = numOfRows*(space+height)+space;
[s setContentSize:CGSizeMake(contentWidth, contentHeight)];
[self.view addSubview:s];
imagesArray
是NSData
Array
相關問題
- 1. 保存照片/圖像到應用程序? iPhone SDK
- 2. iOS - 創建像照片應用程序的照片查看器
- 3. 從照片庫導入多個圖像到應用程序
- 4. 使用PHP從多個圖像創建附加的照片拼貼圖像
- 5. 在iPhone上處理滾動視圖中的許多圖像文件類似於照片應用程序
- 6. iOS |照片應用程序像圖片瀏覽器
- 7. UIActivityViewController - 與像照片應用程序選擇圖片庫分享
- 8. 插入圖片圖像在iPhone應用程序聯繫人頁面ABUnknownPersonViewController視圖
- 9. 如何使用我的應用程序文檔目錄文件夾中的圖像創建照片庫視圖?
- 10. 在iPhone應用程序中保存視圖作爲照片
- 11. 使用移動應用程序splashscreen創建iphone的圖像?
- 12. iPhone應用程序爲通過相機或照片庫獲取的圖像生成縮略圖圖像
- 13. 如何在iPhone中創建像我的照片應用程序的文件夾?
- 14. 如何爲iphone創建圖像應用程序?
- 15. 保存圖像到iPhone的照片庫
- 16. iphone sdk如何從照片庫中獲取完整的圖像?
- 17. 保存覆蓋圖像的相機照片 - iphone SDK
- 18. 如何創建像Instagram一樣的自定義照片視圖?
- 19. 在iphone應用程序的圖像視圖中縮小圖像大小
- 20. 使用「照片metro應用程序」顯示圖像
- 21. iPhone應用程序,需要的照片或視頻,在一個視圖
- 22. 如何從ELCImagePickerController選擇的照片應用程序中刪除多個圖像?
- 23. iPhone:從圖像創建視頻
- 24. 如何在iOS中創建像照片庫視圖一樣的視圖?
- 25. iPhone應用程序:當dissmissing模型視圖按鈕圖像在
- 26. 如何通過iPhone應用程序將照片/圖像加載到Facebook
- 27. 如何在iphone應用程序中將圖像集保存到照片庫
- 28. 使用其他圖像視圖標籤創建圖像視圖
- 29. 如何從疊加的圖像和使用iPhone拍攝的照片創建單個圖像?
- 30. 如何創建像照片應用程序的時間推移視頻?