我想在來自服務器的TableView的每個單元格中顯示多個圖像,我不知道每個表格單元格中圖像的確切數量。
當用戶點擊任何圖像時,它會放大另一個視圖控制器。
我的問題是如何設計這種動態高度的表格,以及如何知道哪些圖像被放大縮小。
謝謝UITableViewCell中的多個圖像,並在iPhone中附加操作
0
A
回答
2
我設計了與您目前正在使用的表格相同的表格。
因爲我已經在每個tableview單元格中使用UIScrollview,所以來自服務器的圖像將顯示在滾動視圖中。
爲了顯示滾動視圖中的圖像,我帶了UIButton,以便識別哪個圖像被按下。
這是我正在做的基本想法。
享受!
1
嘗試使用按鈕製作自定義Tableview單元格。你可以把你的圖像在按鈕和onclick你可以得到發件人標籤,並顯示在另一個視圖控制器中的各自的圖像
有許多教程在互聯網上提供的ios網格視圖檢查出來。
這是一個讓你開始的鏈接 希望這會有所幫助。
http://xebee.xebia.in/2011/04/14/building-editable-gridview-for-iphone-apps/
0
在這裏,我們去:你需要一個自定義單元格來保存照片陣列。
您需要自定義UIImageView來跟蹤觸摸。爲此,您有兩個選項:在頂部添加一個按鈕,或者使用-touchesBegan(請參見下文)。
現在,當你點擊一張圖片,它會告訴它的父母(單元格)哪張照片被按下。 單元格會將信息轉發給RootViewController(帶有UITableView的類),並將其自身添加到信息中。
類需要:
- RootViewController的(這裏未實現)
- 細胞
- CustomImageView
//Cell.h
進口的UIKit/UIKit.h
@class RootViewController; @class CustomImageView; @interface Cell : UITableViewCell { RootViewController *parent; IBOutlet UIView *baseView; //I use this instead of content view; is more ..mutable NSMutableArray *photosArray; double cellHeight; } @property (nonatomic, assign) RootViewController *parent; @property (nonatomic, retain) UIView *baseView; @property (nonatomic, retain) NSMutableArray *photosArray; @property double cellHeight; (void) didClickPhoto: (CustomImageView*) image; @end
//Cell.m
import "Cell.h"
@implementation Cell
@synthesize baseView, photosArray, cellHeight, parent;
- (void) didClickPhoto: (CustomImageView*) image
{
unsigned indexOfSelectedPhoto = [photosArray indexOfObject:image];
//this will allow you to reffere the pressed image;
[parent didClickPhotoAtIndex: indexOfSelectedPhoto inCell: self];
//you will inplement this function in RootViewController
}
@end
CustomImageView.h
#import <UIKit/UIKit.h>
#import "Cell.h"
@interface CustomImageView : UIImageView {
Cell *parent;
}
@property (nonatomic, assign) Cell *parent;
@end
CustomImageView。m
#import "CustomImageView.h"
@implementation CustomImageView
@synthesize parent;
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[parent didClickPhoto:self];
}
@end
這將是我寫過的最長的答案!
相關問題
- 1. 在uitableviewcell中添加多個imageview iphone
- 2. 如何在iphone中添加多個圖像並刪除添加圖像?
- 3. 如何在UITableViewCell中添加一個或多個圖像?
- 4. 在iphone中附加彩信中的本地圖像
- 5. 多個圖像不在iPhone中選擇
- 6. 在UITableViewCell中加載圖像問題
- 7. TTStyledTextLabel在UITableViewCell中加載Web圖像
- 8. 在JADE中附加操作到服務
- 9. 如何發送/附加多個圖像
- 10. Node.js中的多個併發操作
- 11. 多個圖像操作崩潰iPhone應用程序
- 12. UITableViewCell中的圖像在底部附近慢慢變暗
- 13. 在iPhone中的UILabel中添加圖像
- 14. 如何在android中加擾圖像(圖像操作)?
- 15. 如何檢測多個附加圖像並將其切斷?
- 16. 在加載中加載多個圖像
- 17. 在UITableViewCell中保存圖像
- 18. 在UITableViewCell中放大圖像?
- 19. Ruby中的圖像操作
- 20. UITableViewCell加載圖像
- 21. 如何在android中的操作欄上添加多個圖標?
- 22. 添加並從多個AVPlayerItem上的UITableViewCell
- 23. 固定圖像的視圖中的UITableViewCell的iPhone?
- 24. 在UITableViewCell中添加多個UITableViews
- 25. 在React Native中合併多個圖像
- 26. 如何操作javascript中的多個圖像的寬度
- 27. 如何在UITableViewCell中定製附件披露圖像?
- 28. 在Android中的資產從電子郵件中附加多個圖像
- 29. iPhone多重圖像加載
- 30. ios如何在uitableviewcell中顯示多個圖像