我想在来自服务器的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中显示多个图像