質問の主な目的に移る前に、KASlideShowはgithubのライブラリです。私はこのライブラリを使用して画像のスライドショーを表示しています。カスタムセルを実装する方法をたくさん検索した結果、次のような結果が得られました。Is it possible to add UITableView within a UITableViewCellここで私が使用しているコードは次のとおりです。UITableView内のセル内にKASlideShowを追加する方法
#import "HomeTableViewController.h"
#import "KASlideShow.h"
#import "CustomTableViewCell.h"
@interface HomeTableViewController()
@property (strong,nonatomic) IBOutlet KASlideShow * slideshow;
@end
@implementation HomeTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"SlideShowCell"];
if(cell == nil)
{
cell = [[CustomTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SlideShowCell"];
}
[_slideshow setDelay:5]; // Delay between transitions
[_slideshow setTransitionDuration:5]; // Transition duration
[_slideshow setTransitionType:KASlideShowTransitionFade]; // Choose a transition type (fade or slide)
[_slideshow setImagesContentMode:UIViewContentModeScaleAspectFill]; // Choose a content mode for images to display
[_slideshow addImagesFromResources:@[@"adidas.jpg",@"adidas_neo.jpeg"]]; // Add images from resources
[_slideshow addGesture:KASlideShowGestureTap]; // Gesture to go previous/next directly on the image
[_slideshow start];
return cell;
}
@end
#import <UIKit/UIKit.h>
#import "KASlideShow.h"
@interface CustomTableViewCell : UITableViewCell
@property (nonatomic) IBOutlet KASlideShow *slideshow;
#import "CustomTableViewCell.h"
#import "KASlideShow.h"
@implementation CustomTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
@end
@end
KASlideShowは、私は間違って何かがあると知っているが、私は、それはそれを修正する場所を知ることができないのですUITableViewCell
の内側に表示されることはありません。
私はKASlideShowの割り当てが表示されません。また、githubレポはデリゲートを設定する必要があると述べています。削除セットはどこですか? – fsb
@fbara私はデリゲートを追加しようとしましたが、何も変更しませんでした。私はKASlideShowに何も変更しないために割り当てようとしました。 –
あなたの質問を新しいコードで更新できますか? – fsb