0
我从项目中获取源代码并试图将其实施到我的项目中。不幸的是,它没有奏效。经过分析和重新分析之后,我发现细胞扫描仅适用于源代码文件,但不适用于我的。一旦单元滑动在一个项目中工作,但不是其他项目
#import "DHSwipeAwayCell.h"
@implementation DHSwipeAwayCell
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect frame = self.bounds;
self.scrollView.frame = frame;
self.scrollView.contentSize = CGSizeMake(frame.size.width*3, frame.size.height);
self.leftView.frame = frame;
self.centerView.frame = CGRectOffset(frame, frame.size.width, 0);
self.rightView.frame = CGRectOffset(frame, frame.size.width*2, 0);
[self.scrollView scrollRectToVisible:self.centerView.frame animated:NO];
}
@end
我甚至复制了完全相同的细胞进入矿井,而是因为它是:
我复制.h文件到我的项目:
#import <UIKit/UIKit.h>
@interface DHSwipeAwayCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIView *leftView;
@property (weak, nonatomic) IBOutlet UIView *rightView;
@property (weak, nonatomic) IBOutlet UIView *centerView;
@end
和.m文件在我的项目中,它停止了工作。我把班级和班级联系起来。在两个视图控制器中,一切看起来完全相同。也许我的项目中更改了一些设置?我不知道为什么我在两个项目中都有相同的设置,但只有一个正在工作。
您是否连接xib插座? – iCoder
@Norbert是的。一切都联系起来了。 – Eduardo
清理并构建该项目。 – iCoder