Я создал пользовательский AQGridViewCell.Использование TTImageView с AQGridView
С помощью UIImageView все работает. Изображение появляется и доступно для просмотра, но когда я изменяю UIImageView на TTImageView, я не могу нажать на изображение.
В том же примере, как здесь, просто изменив изображение на UIImageView и сообщение setter на изображение, все работает так, как ожидалось.
Вот мой ImageGridCell.h
#import "AQGridViewCell.h"
#import <Three20/Three20.h>
@interface ImageGridCell : AQGridViewCell
{
TTImageView * _imageView;
NSString *urlPath;
}
@property (nonatomic, retain) NSString *urlPath;
@end
А вот мой ImageGridCell.m
#import "ImageGridCell.h"
@implementation ImageGridCell
@synthesize urlPath;
- (id) initWithFrame: (CGRect) frame reuseIdentifier: (NSString *) aReuseIdentifier
{
self = [super initWithFrame: frame reuseIdentifier: aReuseIdentifier];
if (self == nil)
return (nil);
_imageView = [[TTImageView alloc] initWithFrame: CGRectMake(0, 0, 100, 100)];
[_imageView setContentMode:UIViewContentModeScaleAspectFit];
[self.contentView addSubview: _imageView];
return (self);
}
- (void) dealloc
{
[_imageView release];
[super dealloc];
}
- (CALayer *) glowSelectionLayer
{
return (_imageView.layer);
}
- (UIImage *) image
{
return (_imageView.image);
}
-(void)setUrlPath:(NSString *)urlpath {
_imageView.urlPath = urlpath;
}
Я практически сдался, да, это была бы фантастическая идея. Попробуем это –