0
我把一個UIScrollView
上CollectionViewCell
但scrollview
不能滾動放的UIScrollView上CollectionViewCell但滾動視圖不能滾動
#import <UIKit/UIKit.h>
@interface MyCollectionViewCell : UICollectionViewCell<UIScrollViewDelegate>{
IBOutlet UIScrollView *toolsScrollView;
}
@end
@implementation MyCollectionViewCell
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
//wangzheng
self = [super initWithFrame:frame];
if (self) {
NSArray *nibView = [[NSBundle mainBundle] loadNibNamed:@"MyCollectionViewCell"owner:self options:nil];
UIView *bw = [nibView objectAtIndex:0] ;
[self.contentView addSubview:bw];
toolsScrollView.delegate=self;
UIView *toolView1 = [[UIView alloc] init];
toolView1.backgroundColor = [UIColor blackColor];
toolView1.frame = CGRectMake(300, 0, 80, 150);
[toolsScrollView addSubview:toolView1];
toolsScrollView.delegate=self;
[toolsScrollView setContentSize:CGSizeMake(400 * 2, toolsScrollView.frame.size.height)];
toolsScrollView.showsVerticalScrollIndicator = NO;
toolsScrollView.showsHorizontalScrollIndicator = NO;
toolsScrollView.delegate = self;
toolsScrollView.userInteractionEnabled=true;
toolsScrollView.scrollEnabled=true;
}
return self;
}
return self;
}
IBOutlet UIScrollView *toolsScrollView
鏈接到UIScrollView
在廈門國際銀行
滾動視圖不能滾動並且功能scrollViewDidScroll
從不被觸發
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
return;
}
會不偷的CollectionView從滾動視圖的觸摸事件? – Zhang
UICollectionViewCell是UIView的子類 – arachide
在你的collectionView中有相關的代碼嗎? – Bannings